18 lines
614 B
Bash
Executable File
18 lines
614 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# isc dhcpd specific section
|
|
if [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]]; then
|
|
|
|
mkdir -p /etc/dhcp/dhclient-enter-hooks.d
|
|
echo '#!/bin/sh
|
|
if [ "$reason" = "BOUND" ]; then
|
|
if `grep -q "#ListenAddress 0.0.0.0" /etc/ssh/sshd_config`; then
|
|
/bin/sed -i "s/^#ListenAddress 0.0.0.0.*$/ListenAddress $new_ip_address/g" /etc/ssh/sshd_config
|
|
if `/bin/ps -ef|/bin/grep -v grep|/bin/grep -q sshd`; then
|
|
/usr/sbin/service ssh restart
|
|
fi
|
|
fi
|
|
fi' > /etc/dhcp/dhclient-enter-hooks.d/rebind-sshd
|
|
chmod +x /etc/dhcp/dhclient-enter-hooks.d/rebind-sshd
|
|
fi
|