Files
Boilerplates/Linux/Inadyn/README.md
2023-12-21 17:05:08 +01:00

2.9 KiB

Inadyn Installation on AlpineLinux

This is made with the following example for DYNDNS Provider desec.io

domain: mydomain.dedyn.io token: XXXXXXXXXX

Change this in the config file (and maybe duplicate it for mutiple entries)

custom mydomain.dedyn.io {
        username        = mydomain.dedyn.io
        password        = 'XXXXXXXXXX'
        checkip-server  = checkipv4.dedyn.io
        checkip-path    = /
        checkip-ssl     = true
        ddns-server     = update.dedyn.io
        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
        ssl             = true
        hostname        = mydomain.dedyn.io
}
# Use Alpine Edge Repositories
cat <<EOF >/etc/apk/repositories
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
EOF

# Update Alpine Linux
apk update
apk upgrade -a

# Install default Tools (used by ansible f.e.)
apk add nano python3 openssh-server tzdata

# Configure Timezone (Change)
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
#ln -s /usr/share/zoneinfo/Europe/Vienna /etc/localtime

# Make ssh Server autoboot
rc-update add sshd
service sshd start

# Install Inadyn as DynDNS Updater
apk add inadyn
cat <<EOF >/etc/inadyn/inadyn.conf
# How often the IP is checked. The value denotes seconds
period = 300

### Custom provider example
custom dedyn1 {
        username        = mydomain.dedyn.io
        password        = 'XXXXXXXXXX'
        checkip-server  = checkipv4.dedyn.io
        checkip-path    = /
        checkip-ssl     = true
        ddns-server     = update.dedyn.io
        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
        ssl             = true
        hostname        = mydomain.dedyn.io
}

#custom dedyn2 {
#        username        = 2nddomain.dedyn.io
#        password        = 'XXXXXXXXXX'
#        checkip-server  = checkipv4.dedyn.io
#        checkip-path    = /
#        checkip-ssl     = true
#        ddns-server     = update.dedyn.io
#        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
#        ssl             = true
#        hostname        = 2nddomain.dedyn.io
#}
EOF
chmod 600 /etc/inadyn/inadyn.conf

# Adjust initd script to have syslog output for debugging
cat <<EOF >/etc/init.d/inadyn
#!/sbin/openrc-run
name=$RC_SVCNAME
description="DynDNS client"
cfgfile="/etc/$RC_SVCNAME/$RC_SVCNAME.conf"
command="/usr/sbin/$RC_SVCNAME"
command_args="-s --syslog -f $cfgfile"
command_user="$RC_SVCNAME"
supervisor="supervise-daemon"
command_args_foreground="--foreground"

depend() {
        need net
        use logger dns
        after bootmisc
}

start_pre() {
        checkpath --directory --owner $command_user:$command_user --mode 0755 \
                /run/$RC_SVCNAME /var/cache/$RC_SVCNAME
        $command --check-config -f $cfgfile
}
EOF

rc-update add inadyn

# Reboot to have everything nice and fresh
reboot