hover-dns-updater
hover-dns-updater copied to clipboard
Added support for Hover two factor authentication (2FA)
I setup the mobile 2fa and entered the secret key into /etc/hover-dns-updater/hover-dns-updater.json but run into an error
/etc/hover-dns-updater/hover-dns-updater.json
{
"username": "...",
"password": "...",
"toptkey": "...",
"dns_ids": ["..."],
"logfile": "/etc/hover-dns-updater/hover-dns-updater.log",
"poll-time": 300
}
root:~# service hover-dns-updater status
hover-dns-updater.service - Hover DNS Updater for Dynamic IP
Loaded: loaded (/etc/systemd/system/hover-dns-updater.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-05-31 22:22:28 UTC; 864ms ago
Process: 2972 ExecStart=/usr/bin/python3 /etc/hover-dns-updater/hover-dns-updater.py --config /etc/hover-dns-updater/hover-dns-updater.json --service (code=ex>
Main PID: 2972 (code=exited, status=1/FAILURE)
May 31 22:22:28 HAProxy python3[2972]: return self.generate_otp(self.timecode(datetime.datetime.now()))
May 31 22:22:28 HAProxy python3[2972]: File "/usr/local/lib/python3.8/dist-packages/pyotp/otp.py", line 35, in generate_otp
May 31 22:22:28 HAProxy python3[2972]: hasher = hmac.new(self.byte_secret(), self.int_to_bytestring(input), self.digest)
May 31 22:22:28 HAProxy python3[2972]: File "/usr/local/lib/python3.8/dist-packages/pyotp/otp.py", line 52, in byte_secret
May 31 22:22:28 HAProxy python3[2972]: return base64.b32decode(secret, casefold=True)
May 31 22:22:28 HAProxy python3[2972]: File "/usr/lib/python3.8/base64.py", line 231, in b32decode
May 31 22:22:28 HAProxy python3[2972]: raise binascii.Error('Non-base32 digit found') from None
May 31 22:22:28 HAProxy python3[2972]: binascii.Error: Non-base32 digit found
May 31 22:22:28 HAProxy systemd[1]: hover-dns-updater.service: Main process exited, code=exited, status=1/FAILURE
May 31 22:22:28 HAProxy systemd[1]: hover-dns-updater.service: Failed with result 'exit-code'.
When I convert the secret key to 32base and run the service I get,
hover-dns-updater.service - Hover DNS Updater for Dynamic IP
Loaded: loaded (/etc/systemd/system/hover-dns-updater.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-05-31 22:23:36 UTC; 462ms ago
Process: 2985 ExecStart=/usr/bin/python3 /etc/hover-dns-updater/hover-dns-updater.py --config /etc/hover-dns-updater/hover-dns-updater.json --service (code=ex>
Main PID: 2985 (code=exited, status=1/FAILURE)
May 31 22:23:36 HAProxy python3[2985]: ret_code = _main(config)
May 31 22:23:36 HAProxy python3[2985]: File "/etc/hover-dns-updater/hover-dns-updater.py", line 239, in _main
May 31 22:23:36 HAProxy python3[2985]: client = HoverAPI(config)
May 31 22:23:36 HAProxy python3[2985]: File "/etc/hover-dns-updater/hover-dns-updater.py", line 119, in __init__
May 31 22:23:36 HAProxy python3[2985]: self.get_auth()
May 31 22:23:36 HAProxy python3[2985]: File "/etc/hover-dns-updater/hover-dns-updater.py", line 137, in get_auth
May 31 22:23:36 HAProxy python3[2985]: raise HoverException(r)
May 31 22:23:36 HAProxy python3[2985]: __main__.HoverException: <Response [401]>
May 31 22:23:36 HAProxy systemd[1]: hover-dns-updater.service: Main process exited, code=exited, status=1/FAILURE
May 31 22:23:36 HAProxy systemd[1]: hover-dns-updater.service: Failed with result 'exit-code'.
Am I using this wrong?
I ran into a similar issue at the start. I found that I had to remove the spaces from key displayed at end of text "If you can't scan the code, enter this secret key manually: xxxx xxxx xxxx xxxx xxxx xxxx xx" => xxxxxxxxxxxxxxxxxxxxxxxxxx.
Before you save the generated key on Hover you can manually add the site into Google Authenticator. If no errors the key should work in the app so go ahead and save on Hover now...
Awesome, its working now, thanks for the response!