|
@ -76,6 +76,9 @@ _load_credentials() { |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "${cyon_username}" ] || [ -z "${cyon_password}" ]; then |
|
|
if [ -z "${cyon_username}" ] || [ -z "${cyon_password}" ]; then |
|
|
|
|
|
cyon_username="" |
|
|
|
|
|
cyon_password="" |
|
|
|
|
|
cyon_otp_secret="" |
|
|
_err "" |
|
|
_err "" |
|
|
_err "You haven't set your cyon.ch login credentials yet." |
|
|
_err "You haven't set your cyon.ch login credentials yet." |
|
|
_err "Please set the required cyon environment variables." |
|
|
_err "Please set the required cyon environment variables." |
|
@ -168,14 +171,11 @@ _login() { |
|
|
|
|
|
|
|
|
_info " success" |
|
|
_info " success" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NECESSARY!! Load the main page after login, before the OTP check. |
|
|
# NECESSARY!! Load the main page after login, before the OTP check. |
|
|
curl "https://my.cyon.ch/" -s --compressed -b "${cookiejar}" >/dev/null |
|
|
curl "https://my.cyon.ch/" -s --compressed -b "${cookiejar}" >/dev/null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# todo: instead of just checking if the env variable is defined, check if we actually need to do a 2FA auth request. |
|
|
# todo: instead of just checking if the env variable is defined, check if we actually need to do a 2FA auth request. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2FA authentication with OTP? |
|
|
# 2FA authentication with OTP? |
|
|
if [ ! -z "${cyon_otp_secret}" ]; then |
|
|
if [ ! -z "${cyon_otp_secret}" ]; then |
|
|
_info " - Authorising with OTP code..." |
|
|
_info " - Authorising with OTP code..." |
|
@ -298,9 +298,8 @@ _delete_txt() { |
|
|
|
|
|
|
|
|
_dns_entry_num=0 |
|
|
_dns_entry_num=0 |
|
|
|
|
|
|
|
|
echo "${_dns_entries}" | while read -r _hash _identifier |
|
|
|
|
|
do |
|
|
|
|
|
((_dns_entry_num++)) |
|
|
|
|
|
|
|
|
echo "${_dns_entries}" | while read -r _hash _identifier; do |
|
|
|
|
|
_dns_entry_num=$((_dns_entry_num + 1)) |
|
|
|
|
|
|
|
|
delete_txt_response=$(curl \ |
|
|
delete_txt_response=$(curl \ |
|
|
"https://my.cyon.ch/domain/dnseditor/delete-record-async" \ |
|
|
"https://my.cyon.ch/domain/dnseditor/delete-record-async" \ |
|
@ -335,7 +334,7 @@ _delete_txt() { |
|
|
|
|
|
|
|
|
_check_2fa_miss() { |
|
|
_check_2fa_miss() { |
|
|
# Did we miss the 2FA? |
|
|
# Did we miss the 2FA? |
|
|
if [[ "$1" =~ "multi_factor_form" ]] ; then |
|
|
|
|
|
|
|
|
if test "${1#*multi_factor_form}" != "$1"; then |
|
|
_fail " Missed OTP authentication!" |
|
|
_fail " Missed OTP authentication!" |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|