mkorthof/freenom-script

Got Login failed error with freenom.sh [20200312] commit (d2ae539)

Closed this issue ยท 7 comments

Hello @mkorthof,

Thank you for your awesome script I really appreciate it!

And now with the lastes updated, I got Login failed error using the lastest commit version on the Ubuntu Core 16.04 and CentOS 7. It says Login failed, but I had everything correctly set and ran: ./freenom.sh -l -c ./freenom.conf

This is the DEBUG information I colleted by changing debug to 1 in conf file and run ./freenom.sh -l -c ./freenom.conf :

DEBUG: debug=1 c_args=
DEBUG: conf scriptConf=./freenom.conf
Error: logfile "/var/log/freenom/freenom.log" not writable, using "/tmp/freenom.log"

Listing Domains and ID's...

DEBUG: args       debug=1 c_args=-s
DEBUG: args       1=-l 2=-c 3=./freenom.conf 4= 5= 6= 7= 8= 9=
DEBUG: opts/conf  freenom_out_dir=/var/log/freenom freenom_out_mask=freenom out_path=/tmp/freenom
DEBUG: opts/conf  freenom_domain_name= freenom_domain_id= freenom_subdomain_name=
DEBUGL opts/conf  freenom_static=ip=
DEBUG: action     freenom_update_ip=0 freenom_update_force=0 freenom_update_manual=0 freenom_update_all=0
DEBUG: action     freenom_list_records=0 freenom_list=1 freenom_list_renewals=0
DEBUG: action     freenom_renew_domain=0 freenom_renew_all=0
DEBUG: login cookie_file=/tmp/tmp.betAbXH9ww
DEBUG: login curl clientarea token=3d821214ffbc2f19130107ec2a05f5197a34e955 (r=1/3 http_code=200 errCount=0)
Login failed
DEBUG: func_cleanup cookie_file=/tmp/tmp.betAbXH9ww

BUT! If I change the freenom.sh to an older one like v2019-11-17 using exactly the same conf, OS, command line, I can get a good result without any problem so on:

DEBUG: conf scriptConf=./freenom.conf
Error: Logfile "/var/log/freenom/freenom.log" not writable, using "/tmp/freenom.log" instead

Listing Domains and ID's...

DEBUG: args 1=-l 2=-c 3=./freenom.conf 4= 5= 6= 7= 8= 9=
DEBUG: opts/conf freenom_out_dir=/var/log/freenom freenom_out_mask=freenom out_path=/tmp/freenom
DEBUG: opts/conf freenom_domain_name= freenom_domain_id= freenom_subdomain_name=
DEBUGL opts/conf freenom_static=ip=
DEBUG: action    freenom_update_ip=0 freenom_update_force=0 freenom_update_manual=0 freenom_update_all=0
DEBUG: action    freenom_list_records=0 freenom_list=1 freenom_list_renewals=0
DEBUG: action    freenom_renew_domain=0 freenom_renew_all=0
DEBUG: login cookie_file=/tmp/tmp.Z5nkzxyPTN
DEBUG: login curl clientarea token=5f9db429d34a01372feeeb6a31341d29d2a291b2 (r=1/3 http_code=200 errCount=0)
DEBUG: login curl dologin.php username=HIDDEN@HIDDEN.HIDDEN (r=1/3 http_code=200 errCount=0)
DEBUG: domains curl myDomainsPage (r=1/3 http_code=200 errCount=0)
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=17/03/2020 domainExpiryDate=17/03/2021
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=06/01/2020 domainExpiryDate=06/01/2021
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=08/10/2019 domainExpiryDate=08/10/2020
[01] Domain: "HIDDEN.tk" Id: "HIDDEN" RegDate: "17/03/2020" ExpiryDate: "17/03/2021"
[02] Domain: "HIDDEN.tk" Id: "HIDDEN" RegDate: "06/01/2020" ExpiryDate: "06/01/2021"
[03] Domain: "HIDDEN.tk" Id: "HIDDEN" RegDate: "08/10/2019" ExpiryDate: "08/10/2020"

So I just don't know what was going on with the new version of freenom.sh. I hope I can got your help because I don't know how to debug it ๐Ÿ˜ญ .

Thank you very much!

Hi @cottonthread,

Thanks for your report. I have not been able to reproduce this issue yet. I did have some issues connecting to freenom.com it seems (this happens sometimes). I'll look into it further.

Are you using the same .conf? Because there were some config Changes in between those versions:

  • freenom_static_ip=""
  • freenom_update_manual="0"
  • freenom_update_all="0"

Hello, thanks for the reply, here I put my conf file to have your confirm, I already replaced it with the newtest one on the GitHub and getting the same problem:

##########################
# CONFIGURATION SETTINGS #
##########################

##############
# Login data #
##############

# Set variables for email/password -OR- source a "secrets" file
# Examples:
#   freenom_email="John.Smith@example.com"
#   freenom_passwd="your-password"
#   source "/home/${LOGNAME}/.secret/.freenom"

freenom_email="HIDDEN"
freenom_passwd="HIDDEN"


##################
# Get current IP #
##################

freenom_update_ipv="4"        # [4/6] use ipv4 or ipv6
freenom_update_dig="1"        # [0/1] set to "1" to also use 'dig' or "0" for curl only
freenom_static_ip=""          # set manual (static) ip address instead of auto detect

################
# Output files #
################

# Set dir and "file mask" to output results, ip files and log:
#   /dir/to/freenom.log
#   /dir/to/freenom_<domain>.ip{4,6}
#   /dir/to/freenom_renewalResult-<id>.html
# Default: freenom_out_dir="/var/log/freenom"
#          freenom_out_mask="freenom"

freenom_out_dir="/var/log/freenom"
freenom_out_mask="freenom"

######################
# Optional overrides #
######################

# These are ok to leave these as-is

freenom_http_retry="3"        # number of curl retries
freenom_update_force="0"      # [0/1] force ip update, even if unchanged
freenom_update_ttl="3600"     # ttl in sec (changed from 14440 to 3600)
freenom_update_ip_retry="3"   # number of retries to get ip
freenom_update_ip_log="1"     # [0/1] log 'skipped same ip' msg
freenom_renew_log="1"         # [0/1] log renew warnings details
freenom_list_bind="0"         # [0/1] output isc bind zone format
freenom_update_ip="0"         # [0/1] arg "-u"
freenom_update_manual="0"     # [0/1] arg "-m"
freenom_update_all="0"        # [0/1] arg "-a" (future update, not working yet)
freenom_list="0"              # [0/1] arg "-l"
freenom_list_renewals="0"     # [0/1] args "-l -d"
freenom_list_records="0"      # [0/1] arg "-z"
freenom_renew_domain="0"      # [0/1] arg "-r"
freenom_renew_all="0"         # [0/1] args "-r -a"
debug="1"

# Array with useragent strings
uaString+=("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36")
uaString+=("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36")
uaString+=("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0")
uaString+=("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0")
uaString+=("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586,gzip(gfe)")
uaString+=("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")
uaString+=("Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko")
uaString+=("Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0")
uaString+=("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36")
uaString+=("Mozilla/5.0 (iPhone; CPU iPhone OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1")
uaString+=("Mozilla/5.0 (Android 9.0; Mobile; rv:61.0) Gecko/61.0 Firefox/61.0")

# Array with curl and dig commands used to "get ip" on update
# %agent% will be replaced with a random useragent string
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s https://diagnostic.opendns.com/myip")
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s https://www.ripe.net/@@ipaddress")
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s http://ipv6-test.com/api/myip.php")
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s http://checkip.dns.he.net")
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s https://cgi1.apnic.net/cgi-bin/my-ip.php")
ipCmd+=("curl -%ipv% -A %agent% -m 10 -s ipv%ipv%.test-ipv6.com/ip/?callback")
ipCmd+=("curl -4 -A %agent% -m 10 -s https://checkip.amazonaws.com")
ipCmd+=("curl -4 -A %agent% -m 10 -s http://ip.taobao.com/service/getIpInfo.php?ip=myip")
ipCmd+=("dig -%ipv% TXT +short o-o.myaddr.l.google.com @ns1.google.com")
ipCmd+=("dig -4 +short myip.opendns.com @resolver1.opendns.com")
ipCmd+=("dig -4 +short myip.opendns.com @resolver2.opendns.com")
ipCmd+=("dig -4 +short myip.opendns.com @resolver3.opendns.com")
ipCmd+=("dig -4 +short myip.opendns.com @resolver4.opendns.com")
ipCmd+=("dig -4 +short whoami.akamai.net @ns1-1.akamaitech.net")

######################
# Domain name and id #
######################

# [!] The following is not needed anymore and can be skipped if you want,
#     since we can get domain_id's and name automatically now

# Open DNS management page in your browser, URL vs settings:
# https://my.freenom.com/clientarea.php? 
#         managedns={freenom_domain_name}&domainid={freenom_domain_id}
# Examples:
#   freenom_domain_name="example.cf"
#   freenom_subdomain_name=""
#   freenom_domain_id="1234567890"


# NOTE: There is an extra "hidden" option to specify 'domain_id'
#       as 3rd argument in case you need it

######################
# Optional cURL args #
######################

# Default: c_args="-s"
# Useful options:
#   info: "-I", follow links: "-L", be silent: "-s", verbose: "-v" verbose
#   no stdout: "-o /dev/null" (!) use for debug only, causes script to fail
#   proxy: "--http https://localhost", socks5: "--socks localhost:1080"

# Uncomment line below to enable
#c_args="-s -I -L -s -v -o /dev/null --socks localhost:1080"

##########################
# END OF CONFIG SETTINGS #
##########################

Results:

Console:~/freenomnewrelease/freenom-script$ ./freenom.sh.new -c freenom.conf -l

DEBUG: debug=1 c_args=
DEBUG: conf scriptConf=freenom.conf
Error: logfile "/var/log/freenom/freenom.log" not writable, using "/tmp/freenom.sh.new.log"

Listing Domains and ID's...

DEBUG: args       debug=1 c_args=-s
DEBUG: args       1=-c 2=freenom.conf 3=-l 4= 5= 6= 7= 8= 9=
DEBUG: opts/conf  freenom_out_dir=/var/log/freenom freenom_out_mask=freenom out_path=/tmp/freenom.sh.new
DEBUG: opts/conf  freenom_domain_name= freenom_domain_id= freenom_subdomain_name=
DEBUGL opts/conf  freenom_static=ip=
DEBUG: action     freenom_update_ip=0 freenom_update_force=0 freenom_update_manual=0 freenom_update_all=0
DEBUG: action     freenom_list_records=0 freenom_list=1 freenom_list_renewals=0
DEBUG: action     freenom_renew_domain=0 freenom_renew_all=0
DEBUG: login cookie_file=/tmp/tmp.Gbz1a2oZRC
DEBUG: login curl clientarea token=b491867d43fb3432c731df0971e8cc2cc76bafaa (r=1/3 http_code=200 errCount=0)
Login failed
DEBUG: func_cleanup cookie_file=/tmp/tmp.Gbz1a2oZRC


Console:~/freenomnewrelease/freenom-script$ ./freenom.sh.old -c freenom.conf -l

DEBUG: conf scriptConf=freenom.conf
Error: Logfile "/var/log/freenom/freenom.log" not writable, using "/tmp/freenom.sh.old.log" instead

Listing Domains and ID's...

DEBUG: args 1=-c 2=freenom.conf 3=-l 4= 5= 6= 7= 8= 9=
DEBUG: opts/conf freenom_out_dir=/var/log/freenom freenom_out_mask=freenom out_path=/tmp/freenom.sh.old
DEBUG: opts/conf freenom_domain_name= freenom_domain_id= freenom_subdomain_name=
DEBUGL opts/conf freenom_static=ip=
DEBUG: action    freenom_update_ip=0 freenom_update_force=0 freenom_update_manual=0 freenom_update_all=0
DEBUG: action    freenom_list_records=0 freenom_list=1 freenom_list_renewals=0
DEBUG: action    freenom_renew_domain=0 freenom_renew_all=0
DEBUG: login cookie_file=/tmp/tmp.ZJ04x9KrQI
DEBUG: login curl clientarea token=d35ef9b234b4440746e07326dbb30b393bbb1def (r=1/3 http_code=200 errCount=0)
DEBUG: login curl dologin.php username=HIDDEN (r=1/3 http_code=200 errCount=0)
DEBUG: domains curl myDomainsPage (r=1/3 http_code=200 errCount=0)
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=17/03/2020 domainExpiryDate=17/03/2021
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=06/01/2020 domainExpiryDate=06/01/2021
DEBUG: domains curl domainDetails (r=1/3 http_code=200 errCount=0)
DEBUG: domains domainId=HIDDEN domainName=HIDDEN.tk
DEBUG: domains domainRegDate=08/10/2019 domainExpiryDate=08/10/2020
[01] Domain: "HIDDEN" Id: "HIDDEN" RegDate: "17/03/2020" ExpiryDate: "17/03/2021"
[02] Domain: "HIDDEN" Id: "HIDDEN" RegDate: "06/01/2020" ExpiryDate: "06/01/2021"
[03] Domain: "HIDDEN" Id: "HIDDEN" RegDate: "08/10/2019" ExpiryDate: "08/10/2020"

Thanks in advance for your help!

Hi,

Same problem here. With last version of script I can not login to Freenom, but with previous (6ba03ec) I can. My password is alphanumeric only. When I change password escaping in script to -F "password=$freenom_passwd" login work without error.

Maybe this option below can help, if someone use password containing special characters:

-F username="$freenom_email" -F password="$freenom_passwd" -F token="$token"

I try this with latest version of script and with my password login work.

In this moment I using slightly old system for test, Ubuntu 14.04.6 LTS, curl 7.35.0 (i686-pc-linux-gnu), GNU bash 4.3.11(1)-release (i686-pc-linux-gnu).

Regards,

Ok, was finally able to reproduce this too. Thanks for your comment @mkahric

Looks like the issue is related to cURL version. These versions will work with both with the previous commits and newest freedom.sh :

curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

+ GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) 
curl 7.61.1 (x86_64-alpine-linux-musl) libcurl/7.61.1 LibreSSL/2.0.0 zlib/1.2.11 libssh2/1.9.0 nghttp2/1.39.2
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

+ GNU bash, version 4.4.19(1)-release (x86_64-alpine-linux-musl)

When using the same older cURL 7.35.0 version as @mkahric, then indeed only the old freenom.sh commit can login. After (only) updating cURL to 7.69.1 it worked fine.

Besides @mkahric's suggestion, you can also use the following workaround:

https://github.com/mkorthof/freenom-script/blob/master/freenom.sh#L635 :
-F "username=$freenom_email" -F "password=$freenom_passwd" -F "token=$token" \

IIRC I changed the quoting to make sure all combinations of special chars in password would work.

Thank you @mkorthof, I just tried in other, newer environment (CentOS 8.1.1911, GNU bash 4.4.19, curl 7.61.1) and login works using latest version of script.

Suggestion, would be better to default freenom_update_ttl to 300 in freenom.conf, as Freenom DNS default TTL.

Ok, was finally able to reproduce this too. Thanks for your comment @mkahric

Looks like the issue is related to cURL version. These versions will work with both with the previous commits and newest freedom.sh :

curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

+ GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) 
curl 7.61.1 (x86_64-alpine-linux-musl) libcurl/7.61.1 LibreSSL/2.0.0 zlib/1.2.11 libssh2/1.9.0 nghttp2/1.39.2
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

+ GNU bash, version 4.4.19(1)-release (x86_64-alpine-linux-musl)

When using the same older cURL 7.35.0 version as @mkahric, then indeed only the old freenom.sh commit can login. After (only) updating cURL to 7.69.1 it worked fine.

Besides @mkahric's suggestion, you can also use the following workaround:

https://github.com/mkorthof/freenom-script/blob/master/freenom.sh#L635 :
-F "username=$freenom_email" -F "password=$freenom_passwd" -F "token=$token" \

IIRC I changed the quoting to make sure all combinations of special chars in password would work.

Hi,

Same problem here. With last version of script I can not login to Freenom, but with previous (6ba03ec) I can. My password is alphanumeric only. When I change password escaping in script to -F "password=$freenom_passwd" login work without error.

Maybe this option below can help, if someone use password containing special characters:

-F username="$freenom_email" -F password="$freenom_passwd" -F token="$token"

I try this with latest version of script and with my password login work.

In this moment I using slightly old system for test, Ubuntu 14.04.6 LTS, curl 7.35.0 (i686-pc-linux-gnu), GNU bash 4.3.11(1)-release (i686-pc-linux-gnu).

Regards,

WOW, thanks you two! I finally got the latest version going alright!

I checked my cURL version in 2 of my environments:

**Ubuntu 16.04.6 LTS**
**curl 7.47.0** (arm-unknown-linux-gnueabihf) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

and

**CentOS Linux release 7.7.1908 (Core)**
**curl 7.29.0** (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.44 zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets

If the problem is because of cURL, it seems both versions 7.29 and 7.47 can't run correctly with -F "password=\"$freenom_passwd\"" but yes with -F password="$freenom_passwd"

Maybe @mkorthof could upgrade this part in the script for the cURL backward compatibility issue? Because in those OS, maybe not anybody can guesses upgrading the cURL could solve it, as in the default repository (apt, yum) are giving you 7.29 and 7.47 as latest version available, and maybe people just don't know what is causing Login failed like me earlier.

What do you think?

Thanks again to both of you! @mkorthof @mkahric ๐Ÿ‘ !

@cottonthread
In the next version I added a check which detects curl < 7.60 and removes the escaped quotes and there's also an option in conf to force it. I might even remove them completely and folks with special chars in passwords have to manually add them back in conf .

In any case, I'll leave the issue open until I push a new version. If ppl have the same problem they can use the mentioned workarounds. Thanks again for opening the issue.