/usr/lib/bosixnet/update_address is in bosixnet-daemon 1.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/bin/bash
# Config file
CONF_FILE="/etc/bosixnet/bosixnet-daemon.conf"
# Default host name
TMP_STR="$(/*/ifconfig 2> /dev/null | grep ether | sort | sha256sum)"
HOST_NAME="$(uname -n)-${TMP_STR:3:8}"
# Default website URL
URL="http://ipv6.example.com/bosixnet"
# Read settings from config file if it exists
[ -e "${CONF_FILE}" ] && . "${CONF_FILE}"
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if [ ! -z "${NETWORK_DEVICE}" ]; then
IPv6_INFO="$(ip -6 addr show "${NETWORK_DEVICE}" | grep -i global)"
else
IPv6_INFO="$(ip -6 addr | grep -i global)"
fi
if [ ! -z "${IPv6_INFO}" ]; then
# Get current IPv6 address using simple regexp
IPv6_CUR=$(echo "${IPv6_INFO}" | sed -ne "s|^.*inet6\ \(.*\)/[0-9]*\ .*$|\1|p" | tail -n1)
# Check if this IPv6 address is valid
IPv6_CUR="$(echo "${IPv6_CUR}" | grep '^....:.*:.*:.*')"
fi
if [ ! -z "${IPv6_CUR}" ]; then
for DEST in ${URL} ; do
LINK="${DEST}/${HOST_NAME}"
IPv6_OLD="$(curl -L ${LINK} 2> /dev/null)"
if [ "${IPv6_OLD}" != "${IPv6_CUR}" ]; then
curl -L "${LINK}?update=${IPv6_CUR}" &> /dev/null
fi
done
fi
|