Skip to content

Commit 6cb267c

Browse files
committed
verify Dns
1 parent 74dc6c3 commit 6cb267c

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

README.md

+21-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,27 @@ MY_EMAIL_ADDRESS="[email protected]" # REPLACE - used for Let's Encrypt
3131
APPSEC_TOKEN=cp-67c2... # REPLACE WITH REAL TOKEN from Infinity Portal - Docker simple MANAGED profile token
3232
APPSEC_HOSTNAME=appsec1493.klaud.online # REPLACE
3333

34-
# prepare/verify DNS
35-
VMPUBLICIP=$(curl -s ip.iol.cz/ip/)
36-
echo
37-
echo "Make sure DNS recort for $APPSEC_HOSTNAME points to $VMPUBLICIP"
38-
# verify
39-
sudo resolvectl flush-caches
40-
echo "$APPSEC_HOSTNAME points to $(dig +short $APPSEC_HOSTNAME)"
41-
34+
# prepare DNS
35+
function verifyDns {
36+
sudo resolvectl flush-caches
37+
VMPUBLICIP=$(curl -s ip.iol.cz/ip/)
38+
DNSIP=$(dig +short $APPSEC_HOSTNAME)
39+
echo "Checking that DNS recort for $APPSEC_HOSTNAME points to $VMPUBLICIP"
40+
if [ "$VMPUBLICIP" == "$DNSIP" ]; then
41+
echo "Success: DNS points to this VM."
42+
else
43+
if [ -z "$DNSIP" ]; then
44+
echo "DNS record not defined"
45+
else
46+
echo "DNS record points to ***wrong*** IP: $DNSIP"
47+
fi
48+
echo "Failed: please setup DNS record for $APPSEC_HOSTNAME"
49+
fi
50+
}
51+
# run (and rerun after DNS changes)
52+
verifyDns
53+
54+
# ready to install
4255
helm install appsec https://github.com/mkol5222/appsec-chart/releases/download/appsec-0.1.1/appsec-0.1.1.tgz --set cptoken=$APPSEC_TOKEN --set hostname=$APPSEC_HOSTNAME --set letsencrypt.email=$MY_EMAIL_ADDRESS
4356

4457
# monitor appsec and http-01 solver

0 commit comments

Comments
 (0)