beta ovh_domain set CNAME

This commit is contained in:
pvincent
2024-05-07 22:12:58 +04:00
parent b005b15d5b
commit 255adb34e6
4 changed files with 88 additions and 21 deletions
+16 -8
View File
@@ -186,8 +186,13 @@ function build_dmz_certbot {
#TODO: check public ip available
my_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
if hostname -I | grep -q ${my_ip}; then
public_hostname=$(hostname -f)
public_ip=$(dig +short A "${public_hostname}" "@${FDN_NAMESERVER}")
if hostname -I | grep -q "$my_ip"; then
echo "My PUBLIC IP address is: <$my_ip>"
echo "My PUBLIC hostname is: <$public_hostname>"
[[ $my_ip != "$public_ip" ]] && echoerr "This machine provides wrong public IP: <$public_ip>" && exit 101
else
echoerr "This machine can not respond to its PUBLIC IP address: <$my_ip>" #FIXME: && exit 100
fi
@@ -201,11 +206,12 @@ function build_dmz_certbot {
domain=${item[0]}
fqdn=${item[1]}
subDomain=${fqdn%.$domain}
subDomain=${fqdn%".${domain}"}
echo "TODO: fqdn=${fqdn}, domain=${domain}"
local server_ip public_hostname
server_ip=$(dig +short A "$fqdn")
echo "TODO: fqdn=$fqdn, domain=$domain"
local server_ip
server_ip=$(dig +short A $fqdn)
if [[ $server_ip == "$my_ip" ]]; then
echo "CNAME <$fqdn> approved successfuly!"
else
@@ -214,11 +220,13 @@ function build_dmz_certbot {
server_name=$(dig +short CNAME "$fqdn")
echowarn "CNAME <$fqdn> points to another server: <$server_name>"
else
echo TODO:REGISTRAR needed
"$MIAOU_BASEDIR"/lib/registrar/ovh-domain.sh "$domain" "$subDomain"
echo registering "$domain" "$subDomain" to ... "$public_hostname"
"$MIAOU_BASEDIR"/lib/registrar/ovh-domain.sh set "$domain" "$subDomain" "$public_hostname"
echo "TODO: TEST with dig, wait for reply in 4s then certbot!!!"
exit 5
fi
fi
done
else
echo "bypass certbot certificate generation due to target=<$target>"