Skip to content

Instantly share code, notes, and snippets.

@Mihai-P
Last active May 1, 2019 11:13
Show Gist options
  • Select an option

  • Save Mihai-P/75c8daa1dffc6b448c0d1073ebe1cf78 to your computer and use it in GitHub Desktop.

Select an option

Save Mihai-P/75c8daa1dffc6b448c0d1073ebe1cf78 to your computer and use it in GitHub Desktop.
cubox
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
DEBIAN_FRONTEND=noninteractive apt-get -yq install ddclient
echo Username that you use for noip.com?
read USERNAME
echo Password that you use for noip.com?
read PASSWORD
echo What domain you want to update?
read DOMAIN
cat > /etc/ddclient.conf <<EOF
# /etc/ddclient.conf
daemon=150
# syslog=yes
mail=***
mail-failure=***
pid=/var/run/ddclient.pid
ssl=yes
protocol=dyndns2
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
server=dynupdate.no-ip.com
login=$USERNAME
password='$PASSWORD'
$DOMAIN
EOF
cat > /etc/default/ddclient <<EOF
#
# /etc/default/ddclient
# Set to "true" if ddclient should be run every time DHCP client ('dhclient'
# from package isc-dhcp-client) updates the systems IP address.
run_dhclient="false"
# Set to "true" if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup="true"
# Set to "true" if ddclient should run in daemon mode
# If this is changed to true, run_ipup and run_dhclient must be set to false.
run_daemon="true"
# Set the time interval between the updates of the dynamic DNS name in seconds.
# This option only takes effect if the ddclient runs in daemon mode.
daemon_interval="300"
EOF
ddclient -daemon=1
if [ ! -e /dev/net/tun ]; then
echo "Openvpn already installed. skipping installation."
return 1
fi
wget --output-document=openvpn-install.sh https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
./openvpn-install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment