mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-15 14:56:13 +01:00
89341fe2a5
crufy and generally make all of this easier to understand and modify.
142 lines
3.7 KiB
Bash
142 lines
3.7 KiB
Bash
#!/bin/sh -
|
|
#
|
|
# $Id: netstart,v 1.23 1995/03/22 18:00:35 jkh Exp $
|
|
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
|
|
|
|
# my-name is my symbolic name
|
|
# my-netmask is specified in /etc/networks
|
|
#
|
|
if [ -z "`hostname -s`" ] ; then
|
|
hostname $hostname
|
|
fi
|
|
|
|
# Set the domainname if we're using NIS
|
|
if [ -z "`domainname`" -a -e "/etc/defaultdomain" ] ; then
|
|
domainname=`cat /etc/defaultdomain`
|
|
domainname $domainname
|
|
fi
|
|
|
|
for i in /etc/hostname.*
|
|
do
|
|
ifn=`expr $i : '/etc/hostname\.\(.*\)'`
|
|
if [ -e /etc/hostname.$ifn ]; then
|
|
if [ -e /etc/start_if.$ifn ]; then
|
|
sh /etc/start_if.$ifn $ifn
|
|
fi
|
|
ifconfig $ifn `cat /etc/hostname.$ifn`
|
|
ifconfig $ifn
|
|
fi
|
|
done
|
|
|
|
# set the address for the loopback interface
|
|
ifconfig lo0 inet localhost
|
|
|
|
# set interface for multicasts to default interface
|
|
# this needs to happen before router discovery
|
|
route add 224.0.0.0 -netmask 0xf0000000 -interface $hostname
|
|
|
|
if [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then
|
|
route add default $defaultrouter
|
|
elif [ -f /etc/defaultrouter ] ; then
|
|
route add default `cat /etc/defaultrouter`
|
|
fi
|
|
|
|
# use loopback, not the wire
|
|
# route add $hostname localhost
|
|
|
|
echo -n starting network daemons:
|
|
|
|
# Portmapper should always be run, to provide RPC services for inetd.
|
|
if [ -x /usr/sbin/portmap ]; then
|
|
echo -n ' portmap'; portmap
|
|
fi
|
|
|
|
# $gated and $routedflags are imported from /etc/sysconfig.
|
|
# If $gated == YES, gated is used; otherwise routed.
|
|
# If $routedflags == NO, routed isn't run.
|
|
if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then
|
|
echo -n ' gated'; gated $gatedflags
|
|
elif [ "X${routedflags}" != X"NO" ]; then
|
|
echo -n ' routed'; routed $routedflags
|
|
fi
|
|
|
|
# $namedflags is imported from /etc/sysconfig
|
|
if [ "X${namedflags}" != "XNO" ]; then
|
|
echo -n ' named'; named $namedflags
|
|
fi
|
|
|
|
# $ntpdate and $xntpdflags are imported from /etc/sysconfig.
|
|
# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
|
|
# If $xntpdflags != NO, start xntpd.
|
|
if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then
|
|
if [ "X${tickadjflags}" != X"NO" ]; then
|
|
echo -n ' tickadj'; tickadj ${tickadjflags--Aq}
|
|
fi
|
|
|
|
if [ "X${ntpdate}" != X"NO" ]; then
|
|
echo -n ' ntpdate'; ntpdate ${ntpdate}
|
|
fi
|
|
|
|
if [ "X${xntpdflags}" != X"NO" ]; then
|
|
echo -n ' xntpd'; xntpd ${xntpdflags}
|
|
fi
|
|
fi
|
|
|
|
# $timedflags is imported from /etc/sysconfig;
|
|
# if $timedflags == NO, timed isn't run.
|
|
if [ "X${timedflags}" != X"NO" ]; then
|
|
echo -n ' timed'; timed $timedflags
|
|
fi
|
|
|
|
# $rwhod is imported from /etc/sysconfig;
|
|
# if $rwhod is set to YES, rwhod is run.
|
|
if [ "X${rwhod}" = X"YES" ]; then
|
|
echo -n ' rwhod'; rwhod
|
|
fi
|
|
|
|
if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then
|
|
echo -n ' mountd'; mountd
|
|
echo -n ' nfsd'; nfsd -u -t 4
|
|
fi
|
|
|
|
if [ "X${nfs_client}" = X"YES" ]; then
|
|
echo -n ' nfsiod'; nfsiod -n 4
|
|
fi
|
|
|
|
if [ "X${amdflags}" != X"NO" ]; then
|
|
echo -n ' amd'; amd ${amdflags}
|
|
fi
|
|
|
|
# $sendmail_flags is imported from /etc/sysconfig;
|
|
# if $sendmail_flags is something other than NO, sendmail is run.
|
|
if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
|
|
echo -n ' sendmail'; sendmail ${sendmail_flags}
|
|
fi
|
|
|
|
# Kerberos runs ONLY on the Kerberos server machine
|
|
if [ "X${kerberos_server}" = X"YES" ]; then
|
|
echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
|
|
echo -n ' kadmind'; \
|
|
(sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) &
|
|
fi
|
|
|
|
# Start ypserv if we're an NIS server.
|
|
# Run yppasswdd only on the NIS master server
|
|
if [ "X${nis_serverflags}" != X"NO" ]; then
|
|
echo -n ' ypserv'; ypserv ${nis_serverflags}
|
|
|
|
if [ "X${yppasswddflags}" != X"NO" ]; then
|
|
echo -n ' yppasswdd'; yppasswdd ${yppasswddflags}
|
|
fi
|
|
fi
|
|
|
|
|
|
# Start ypbind if we're an NIS client
|
|
if [ "X${nis_clientflags}" != X"NO" ]; then
|
|
echo -n ' ypbind'; ypbind ${nis_clientflags}
|
|
fi
|
|
|
|
echo -n ' inetd'; inetd
|
|
echo '.'
|
|
|