various fixes, internal mail server
[distro-setup] / dynamic-ip-update.sh
1 #!/bin/bash -l
2
3
4 # note: in practice, I've not seen my ip address change under comcast
5 # for over a year. If the internet hadn't mislead me, I wouldn't have
6 # bothered.
7
8
9
10
11 # based on: https://www.namecheap.com/support/knowledgebase/article.aspx/36/11/how-do-i-start-using-dynamic-dns
12
13 # go to advanced dns, enable the little slider checkbox for dynamic dns,
14 # add dnynamic dns records for @ and * (not sure * will work, but eh),
15 # with the initial ip you want. remove any other host records, for example
16 # the initial default ones. copy the dynamic dns password to /p/dynamic-ip-pass.
17
18 # other articles I found usefull previously, but not the last time
19 # http://mwholt.blogspot.com/2013/09/how-to-set-up-dynamic-dns-in-5-minutes.html
20 # https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient
21
22 ip=`curl -s4 echoip.com`
23 curl -sS "https://dynamicdns.park-your-domain.com/update?host=@&domain=$HOME_DOMAIN&password=$(cat /p/dynamic-ip-pass)&ip=$ip" > /dev/null | /a/exe/log-once dynamic-ip
24
25 # an alternative, putting my ip on some known server,
26 # allows ssh to home if I can access that server:
27 # ssh -o "ProxyCommand ssh someserver -W desktop:22" desktop
28
29 # ssh root@some_server bash <<'EOF' | log-once dynamic-ip
30 # sed -i --follow-symlinks '/desktop$/d' /etc/hosts
31 # echo "${SSH_CLIENT%% *} desktop" >> /etc/hosts
32 # EOF