qwell: branch aadk r799 - /branches/aadk/scripts/networking.sh
asterisk-gui-commits at lists.digium.com
asterisk-gui-commits at lists.digium.com
Fri Apr 27 12:15:17 MST 2007
Author: qwell
Date: Fri Apr 27 14:15:16 2007
New Revision: 799
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=799
Log:
Make sure we disable SSH (and other inetd services...eventually?) when we say to not enable it.
Also minor cleanup to networking script variables.
Modified:
branches/aadk/scripts/networking.sh
Modified: branches/aadk/scripts/networking.sh
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/scripts/networking.sh?view=diff&rev=799&r1=798&r2=799
==============================================================================
--- branches/aadk/scripts/networking.sh (original)
+++ branches/aadk/scripts/networking.sh Fri Apr 27 14:15:16 2007
@@ -9,9 +9,13 @@
WAN_INTERFACE="eth0"
LAN_INTERFACE="eth1"
DNS_CONFIG="/etc/config/resolv.conf"
-DHCP_CONFIG="/etc/udhcpd.conf"
-DHCP_BIN="`which udhcpd`"
-DHCP_SERVER="udhcpd"
+DHCPD_CONFIG="/etc/udhcpd.conf"
+DHCPD_BIN="`which udhcpd`"
+DHCPD_PROCNAME="udhcpd"
+INETD_CONFIG="/etc/inetd.conf"
+INETD_BIN="`which inetd`"
+INETD_PROCNAME="inetd"
+INETD_LINE_SSH="ssh stream tcp nowait root /bin/dropbear -i 2 > /dev/null"
ARG_FILE="/etc/asterisk/scripts/network.params"
@@ -47,20 +51,26 @@
# Set our time server
if [ "${NTP_LAN}" != "" ]; then
- killall -9 ntpdate
+ killall -9 ntpdate 2> /dev/null
ntpdate ${NTP_LAN} &
fi
+# Handle inetd services.
+rm -f ${INETD_CONFIG} ${INETD_CONFIG}.*
+
# Turn on our ssh server
if [ "${SSHACCESS}" = "yes" ]; then
- inetd &
+ echo "${INETD_LINE_SSH}" > ${INETD_CONFIG}.ssh
fi
+
+cat ${INETD_CONFIG}.* > ${INETD_CONFIG}
+killall -HUP ${INETD_PROCNAME}
# Setup the WAN interface.
if [ "${DHCP_WAN}" = "on" ]; then
# If dhcp_wan is set from the gui
- killall -9 dhcpcd
- killall -9 dhcpcd.real
+ killall -9 dhcpcd 2> /dev/null
+ killall -9 dhcpcd.real 2> /dev/null
dhcpcd ${WAN_INTERFACE} &
else
echo "WAN interface is ${WAN_INTERFACE} WAN IP is ${IP_WAN} WAN subnet is ${SUBNET_WAN}"
@@ -85,35 +95,35 @@
echo "LAN network is ${NETWORK_LAN}"
if [ "${DHCP_LAN}" != "off" ]; then
# Now we will edit /etc/udhcpd.conf
- echo "start ${START_RANGE_LAN}" > ${DHCP_CONFIG}
- echo "end ${END_RANGE_LAN}" >> ${DHCP_CONFIG}
- echo "interface ${LAN_INTERFACE}" >> ${DHCP_CONFIG}
- echo "max_leases ${MAX_LEASE}" >> ${DHCP_CONFIG}
- echo "remaining yes" >> ${DHCP_CONFIG}
- echo "opt subnet ${SUBNET_LAN}" >> ${DHCP_CONFIG}
+ echo "start ${START_RANGE_LAN}" > ${DHCPD_CONFIG}
+ echo "end ${END_RANGE_LAN}" >> ${DHCPD_CONFIG}
+ echo "interface ${LAN_INTERFACE}" >> ${DHCPD_CONFIG}
+ echo "max_leases ${MAX_LEASE}" >> ${DHCPD_CONFIG}
+ echo "remaining yes" >> ${DHCPD_CONFIG}
+ echo "opt subnet ${SUBNET_LAN}" >> ${DHCPD_CONFIG}
if [ "${DNS_LAN}" != "" ]; then
- echo "opt dns ${DNS_LAN}" >> ${DHCP_CONFIG}
+ echo "opt dns ${DNS_LAN}" >> ${DHCPD_CONFIG}
fi
if [ "${ROUTER_LAN}" != "" ]; then
- echo "opt router ${ROUTER_LAN}" >> ${DHCP_CONFIG}
+ echo "opt router ${ROUTER_LAN}" >> ${DHCPD_CONFIG}
else
- echo "opt router ${IP_LAN}" >> ${DHCP_CONFIG}
+ echo "opt router ${IP_LAN}" >> ${DHCPD_CONFIG}
fi
if [ "${DOMAIN_LAN}" != "" ]; then
- echo "opt domain ${DOMAIN_LAN}" >> ${DHCP_CONFIG}
+ echo "opt domain ${DOMAIN_LAN}" >> ${DHCPD_CONFIG}
fi
if [ "${LEASE_LAN}" != "" ]; then
- echo "opt lease ${LEASE_LAN}" >> ${DHCP_CONFIG}
+ echo "opt lease ${LEASE_LAN}" >> ${DHCPD_CONFIG}
else
- echo "opt lease 8640000" >> ${DHCP_CONFIG}
+ echo "opt lease 8640000" >> ${DHCPD_CONFIG}
fi
if [ "${TFTP_LAN}" != "" ]; then
- echo "opt tftp ${TFTP_LAN}" >> ${DHCP_CONFIG}
+ echo "opt tftp ${TFTP_LAN}" >> ${DHCPD_CONFIG}
fi
if [ "${NTP_LAN}" != "" ]; then
- echo "opt ntpsrv ${NTP_LAN}" >> ${DHCP_CONFIG}
+ echo "opt ntpsrv ${NTP_LAN}" >> ${DHCPD_CONFIG}
fi
# Stop and restart our dhcp server.
- killall -9 ${DHCP_SERVER}
- ${DHCP_BIN} &
+ killall -9 ${DHCPD_PROCNAME} 2> /dev/null
+ ${DHCPD_BIN} &
fi
More information about the asterisk-gui-commits
mailing list