Annotation of src/etc/rc, Revision 1.316
1.316 ! mbalmer 1: # $OpenBSD: rc,v 1.315 2008/06/08 03:03:37 jdixon Exp $
1.1 deraadt 2:
3: # System startup script run by init on autoboot
4: # or after single-user.
5: # Output and error are redirected to console by init,
6: # and the console is the controlling terminal.
7:
1.131 millert 8: # Subroutines (have to come first).
9:
10: # Strip comments (and leading/trailing whitespace if IFS is set)
11: # from a file and spew to stdout
12: stripcom() {
13: local _file="$1"
14: local _line
15:
16: {
17: while read _line ; do
18: _line=${_line%%#*} # strip comments
19: test -z "$_line" && continue
20: echo $_line
21: done
22: } < $_file
23: }
24:
1.265 millert 25: # Update resource limits when sysctl changes
26: # Usage: update_limit -X loginconf_name
27: update_limit() {
28: local _fl="$1" # ulimit flag
29: local _lc="$2" # login.conf name
30: local _new _suf
31:
32: for _suf in "" -cur -max; do
33: _new=`getcap -f /etc/login.conf -s ${_lc}${_suf} daemon 2>/dev/null`
34: if [ X"$_new" != X"" ]; then
35: if [ X"$_new" = X"infinity" ]; then
36: _new=unlimited
37: fi
38: case "$_suf" in
39: -cur)
40: ulimit -S $_fl $_new
41: ;;
42: -max)
43: ulimit -H $_fl $_new
44: ;;
45: *)
46: ulimit $_fl $_new
47: return
48: ;;
49: esac
50: fi
51: done
52: }
53:
54: sysctl_conf() {
1.267 millert 55: test -s /etc/sysctl.conf || return
56:
1.265 millert 57: # delete comments and blank lines
58: set -- `stripcom /etc/sysctl.conf`
59: while [ $# -ge 1 ] ; do
60: sysctl $1
61: # update limits if needed
62: case $1 in
63: kern.maxproc=*)
64: update_limit -p maxproc
65: ;;
66: kern.maxfiles=*)
67: update_limit -n openfiles
68: ;;
69: esac
70: shift
71: done
72: }
73:
74: mixerctl_conf()
75: {
1.267 millert 76: test -s /etc/mixerctl.conf || return
77:
1.265 millert 78: # delete comments and blank lines
79: set -- `stripcom /etc/mixerctl.conf`
80: while [ $# -ge 1 ] ; do
81: mixerctl -q $1 > /dev/null 2>&1
82: shift
83: done
84: }
85:
1.267 millert 86: wsconsctl_conf()
87: {
88: local save_IFS="$IFS"
89:
90: test -x /sbin/wsconsctl -a -s /etc/wsconsctl.conf || return
91: # delete comments and blank lines
92: IFS="
93: "
94: set -- `stripcom /etc/wsconsctl.conf`
95: IFS="$save_IFS"
96: while [ $# -ge 1 ] ; do
1.307 jmc 97: eval /sbin/wsconsctl $1
1.267 millert 98: shift
99: done
100: }
101:
1.312 djm 102: random_seed()
103: {
104: if [ -f /var/db/host.random -a "X$random_seed_done" = "X" ]; then
105: dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
106: > /dev/null 2>&1
107: dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
108: > /dev/null 2>&1
109:
110: # reset seed file, so that if a shutdown-less reboot occurs,
111: # the next seed is not a repeat
112: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
113: > /dev/null 2>&1
114:
115: random_seed_done=1
116: fi
117: }
118:
1.131 millert 119: # End subroutines
120:
1.1 deraadt 121: stty status '^T'
122:
123: # Set shell to ignore SIGINT (2), but not children;
124: # shell catches SIGQUIT (3) and returns to single user after fsck.
125: trap : 2
126: trap : 3 # shouldn't be needed
127:
128: HOME=/; export HOME
129: PATH=/sbin:/bin:/usr/sbin:/usr/bin
130: export PATH
1.108 deraadt 131:
1.266 millert 132: if [ X"$1" = X"shutdown" ]; then
1.108 deraadt 133: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
134: chmod 600 /var/db/host.random >/dev/null 2>&1
135: if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then
136: echo /etc/rc.shutdown in progress...
137: . /etc/rc.shutdown
138: echo /etc/rc.shutdown complete.
1.240 mcbride 139:
140: # bring carp interfaces down gracefully
1.304 espie 141: ifconfig -a|grep '^carp.*:'|cut -f1 -d:|while read if
142: do
143: ifconfig $if down
1.240 mcbride 144: done
1.246 mcbride 145:
1.266 millert 146: if [ X"${powerdown}" = X"YES" ]; then
1.246 mcbride 147: exit 2
148: fi
149:
1.108 deraadt 150: else
151: echo single user: not running /etc/rc.shutdown
152: fi
153: exit 0
154: fi
1.1 deraadt 155:
156: # Configure ccd devices.
1.17 deraadt 157: if [ -f /etc/ccd.conf ]; then
1.1 deraadt 158: ccdconfig -C
159: fi
1.98 jakob 160:
161: # Configure raid devices.
162: for dev in 0 1 2 3; do
163: if [ -f /etc/raid$dev.conf ]; then
164: raidctl -c /etc/raid$dev.conf raid$dev
165: fi
166: done
1.190 tdeval 167:
168: # Check parity on raid devices.
1.191 deraadt 169: raidctl -P all
1.1 deraadt 170:
1.172 miod 171: swapctl -A -t blk
1.170 deraadt 172:
1.17 deraadt 173: if [ -e /fastboot ]; then
1.1 deraadt 174: echo "Fast boot: skipping disk checks."
1.266 millert 175: elif [ X"$1" = X"autoboot" ]; then
1.1 deraadt 176: echo "Automatic boot in progress: starting file system checks."
1.31 millert 177: fsck -p
1.1 deraadt 178: case $? in
179: 0)
180: ;;
181: 2)
182: exit 1
183: ;;
184: 4)
185: echo "Rebooting..."
186: reboot
187: echo "Reboot failed; help!"
188: exit 1
189: ;;
190: 8)
191: echo "Automatic file system check failed; help!"
192: exit 1
193: ;;
194: 12)
195: echo "Boot interrupted."
196: exit 1
197: ;;
198: 130)
199: # interrupt before catcher installed
200: exit 1
201: ;;
202: *)
203: echo "Unknown error; help!"
204: exit 1
205: ;;
206: esac
207: fi
208:
209: trap "echo 'Boot interrupted.'; exit 1" 3
210:
211: umount -a >/dev/null 2>&1
1.303 grunk 212: mount -a -t nonfs,vnd
1.57 niklas 213: mount -uw / # root on nfs requires this, others aren't hurt
1.1 deraadt 214: rm -f /fastboot # XXX (root now writeable)
1.177 deraadt 215:
1.312 djm 216: random_seed
217:
1.177 deraadt 218: # pick up option configuration
219: . /etc/rc.conf
1.1 deraadt 220:
1.255 henning 221: # set flags on ttys. (do early, in case they use tty for SLIP in netstart)
1.1 deraadt 222: echo 'setting tty flags'
223: ttyflags -a
1.77 angelos 224:
1.252 mcbride 225: if [ -f /sbin/kbd -a -f /etc/kbdtype ]; then
226: kbd `cat /etc/kbdtype`
227: fi
228:
1.279 deraadt 229: wsconsctl_conf
230:
1.266 millert 231: if [ X"${pf}" != X"NO" ]; then
1.211 mcbride 232: RULES="block all"
1.228 henning 233: RULES="$RULES\npass on lo0"
1.195 dhartmei 234: RULES="$RULES\npass in proto tcp from any to any port 22 keep state"
1.208 camield 235: RULES="$RULES\npass out proto { tcp, udp } from any to any port 53 keep state"
1.215 camield 236: RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
1.257 grange 237: if ifconfig lo0 inet6 >/dev/null 2>&1; then
1.258 itojun 238: RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type neighbrsol"
239: RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type neighbradv"
1.257 grange 240: RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type routersol"
241: RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type routeradv"
242: fi
1.309 mpf 243: RULES="$RULES\npass proto carp"
1.193 deraadt 244: case `sysctl vfs.mounts.nfs 2>/dev/null` in
1.184 deraadt 245: *[1-9]*)
246: # don't kill NFS
1.218 cedric 247: RULES="scrub in all no-df\n$RULES"
1.306 deraadt 248: RULES="$RULES\npass in proto { tcp, udp } from any port { 111, 2049 } to any"
249: RULES="$RULES\npass out proto { tcp, udp } from any to any port { 111, 2049 }"
1.184 deraadt 250: ;;
251: esac
1.269 dhartmei 252: echo $RULES | pfctl -f -
253: pfctl -e
1.176 kjell 254: fi
255:
1.267 millert 256: sysctl_conf
1.260 jsg 257:
1.1 deraadt 258: # set hostname, turn on network
259: echo 'starting network'
1.289 henning 260: ifconfig -g carp carpdemote 128
1.264 deraadt 261: if [ -f /etc/resolv.conf.save ]; then
262: mv /etc/resolv.conf.save /etc/resolv.conf
263: touch /etc/resolv.conf
264: fi
1.1 deraadt 265: . /etc/netstart
1.176 kjell 266:
1.266 millert 267: if [ X"${pf}" != X"NO" ]; then
1.176 kjell 268: if [ -f ${pf_rules} ]; then
1.198 dhartmei 269: pfctl -f ${pf_rules}
1.309 mpf 270: fi
271: # bring up pfsync after the working ruleset has been loaded
272: if [ -f /etc/hostname.pfsync0 ]; then
273: . /etc/netstart pfsync0
1.176 kjell 274: fi
275: fi
1.1 deraadt 276:
1.278 otto 277: mount -s /usr >/dev/null 2>&1
278: mount -s /var >/dev/null 2>&1
1.180 deraadt 279:
1.149 deraadt 280: # if there's no /var/db/host.random, make one through /dev/urandom
281: if [ ! -f /var/db/host.random ]; then
282: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
283: >/dev/null 2>&1
284: chmod 600 /var/db/host.random >/dev/null 2>&1
285: else
1.312 djm 286: # Try to read seed if it was not initially present (e.g. /var on NFS)
287: random_seed
1.149 deraadt 288: fi
1.29 deraadt 289:
1.55 deraadt 290: # clean up left-over files
291: rm -f /etc/nologin
292: rm -f /var/spool/lock/LCK.*
293: rm -f /var/spool/uucp/STST/*
1.247 henning 294: (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
1.196 beck 295: (cd /var/authpf && rm -rf -- *)
1.96 alex 296:
297: # save a copy of the boot messages
298: dmesg >/var/run/dmesg.boot
1.55 deraadt 299:
1.58 deraadt 300: echo 'starting system logger'
301: rm -f /dev/log
1.266 millert 302: if [ X"${named_flags}" != X"NO" ]; then
1.220 jakob 303: rm -f /var/named/dev/log
304: syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
1.216 millert 305: fi
306: if [ -d /var/empty ]; then
307: rm -f /var/empty/dev/log
308: mkdir -p -m 0555 /var/empty/dev
309: syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
1.74 millert 310: fi
1.65 marc 311: syslogd ${syslogd_flags}
1.184 deraadt 312:
1.310 sthen 313: if [ X"${pf}" != X"NO" ]; then
1.294 henning 314: ifconfig pflog0 create >/dev/null 2>&1
1.261 millert 315: if ifconfig pflog0 >/dev/null 2>&1; then
316: ifconfig pflog0 up
1.310 sthen 317: if [ X"${pflogd_flags}" != X"NO" ]; then
318: pflogd ${pflogd_flags}
319: fi
1.261 millert 320: fi
1.217 jakob 321: fi
322:
1.266 millert 323: if [ X"${named_flags}" != X"NO" ]; then
1.221 jakob 324: if ! cmp -s /etc/rndc.key /var/named/etc/rndc.key ; then
325: echo -n "rndc-confgen: generating new shared secret... "
326: if /usr/sbin/rndc-confgen -a -t /var/named >/dev/null 2>&1; then
327: chmod 0640 /var/named/etc/rndc.key >/dev/null 2>&1
328: echo done.
329: else
330: echo failed.
331: fi
332: fi
333:
1.58 deraadt 334: echo 'starting named'; named $named_flags
1.287 mcbride 335: fi
336:
1.290 mpf 337: if [ X"${isakmpd_flags}" != X"NO" ]; then
338: if [ X"${sasyncd_flags}" != X"NO" ]; then
339: isakmpd_flags="-S ${isakmpd_flags}"
340: fi
341: echo 'starting isakmpd'; isakmpd ${isakmpd_flags}
342: fi
343:
1.287 mcbride 344: if [ X"${sasyncd_flags}" != X"NO" ]; then
345: echo 'starting sasyncd'; sasyncd ${sasyncd_flags}
1.280 hshoexer 346: fi
347:
348: if [ X"${ipsec}" != X"NO" ]; then
349: if [ -f ${ipsec_rules} ]; then
350: ipsecctl -f ${ipsec_rules}
351: fi
1.40 provos 352: fi
1.1 deraadt 353:
1.276 tom 354: echo -n 'starting initial daemons:'
1.24 millert 355:
356: if [ X"${portmap}" = X"YES" ]; then
1.23 deraadt 357: echo -n ' portmap'; portmap
358: fi
1.1 deraadt 359:
1.273 deraadt 360: if [ X`domainname` != X ]; then
1.8 deraadt 361: if [ -d /var/yp/`domainname` ]; then
1.273 deraadt 362: # YP server capabilities needed...
1.36 niklas 363: echo -n ' ypserv'; ypserv ${ypserv_flags}
1.16 deraadt 364: #echo -n ' ypxfrd'; ypxfrd
1.21 deraadt 365: fi
366:
1.273 deraadt 367: if [ -d /var/yp/binding ]; then
368: # YP client capabilities needed...
369: echo -n ' ypbind'; ypbind
370: fi
1.8 deraadt 371:
1.232 deraadt 372: if [ X"${yppasswdd_flags}" != X"NO" -a -d /var/yp/`domainname` ]; then
1.8 deraadt 373: # if we are the master server, run rpc.yppasswdd
374: _host1=`ypwhich -m passwd 2> /dev/null`
375: _host2=`hostname`
1.15 deraadt 376: if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then
1.8 deraadt 377: _host1=`ypmatch $_host1 hosts | cut -d' ' -f2`
378: _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1`
379: else
1.263 deraadt 380: _host1=`echo $_host1 | nslookup | grep '^Name: ' | \
1.8 deraadt 381: sed -e 's/^Name: //'`
1.263 deraadt 382: _host2=`echo $_host2 | nslookup | grep '^Name: ' | \
1.8 deraadt 383: sed -e 's/^Name: //'`
384: fi
1.13 deraadt 385: if [ "$_host2" = "$_host1" ]; then
1.35 niklas 386: echo -n ' rpc.yppasswdd'
387: rpc.yppasswdd ${yppasswdd_flags}
1.8 deraadt 388: fi
1.7 deraadt 389: fi
1.1 deraadt 390: fi
391:
1.266 millert 392: if [ X"${nfs_server}" = X"YES" -a -s /etc/exports -a \
1.141 deraadt 393: `sed -e '/^#/d' < /etc/exports | wc -l` -ne 0 ]; then
1.68 millert 394: rm -f /var/db/mountdtab
1.1 deraadt 395: echo -n > /var/db/mountdtab
1.283 avsm 396: echo -n ' mountd'; mountd
1.42 niklas 397: echo -n ' nfsd'; nfsd ${nfsd_flags}
1.266 millert 398: if [ X"${lockd}" = X"YES" ]; then
1.42 niklas 399: echo -n ' rpc.lockd'; rpc.lockd
400: fi
1.1 deraadt 401: fi
402:
1.266 millert 403: if [ X"${amd}" = X"YES" -a -e ${amd_master} ]; then
1.1 deraadt 404: echo -n ' amd'
1.107 deraadt 405: (cd /etc/amd; amd -l syslog -x error,noinfo,nostats -p \
406: -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid )
1.146 matt 407: fi
408:
1.255 henning 409: # run rdate before timed/ntpd
410: if [ X"${rdate_flags}" != X"NO" ]; then
411: echo -n ' rdate'; rdate -s ${rdate_flags}
412: fi
413:
1.266 millert 414: if [ X"${timed_flags}" != X"NO" ]; then
1.255 henning 415: echo -n ' timed'; timed $timed_flags
1.302 ckuethe 416: fi
417:
1.316 ! mbalmer 418: if [ X"${ldattach_flags}" != X"NO" -a -n "${ldattach_flags}" ]; then
! 419: echo -n ' ldattach'; ldattach ${ldattach_flags}
1.255 henning 420: fi
421:
1.266 millert 422: if [ X"${ntpd_flags}" != X"NO" ]; then
1.270 deraadt 423: echo -n ' ntpd'; ntpd $ntpd_flags
1.255 henning 424: fi
1.1 deraadt 425: echo '.'
1.58 deraadt 426:
1.278 otto 427: mount -a
1.172 miod 428:
429: swapctl -A -t noblk
1.1 deraadt 430:
431: # /var/crash should be a directory or a symbolic link
432: # to the crash directory if core dumps are to be saved.
433: if [ -d /var/crash ]; then
1.188 tholo 434: savecore ${savecore_flags} /var/crash
1.1 deraadt 435: fi
436:
1.266 millert 437: if [ X"${afs}" = X"YES" -a -c /dev/xfs0 ]; then
1.90 art 438: echo -n 'mounting afs:'
1.233 beck 439: mkdir -p -m 0755 /afs
440: mount -t xfs /dev/xfs0 /afs
1.245 deraadt 441: /usr/libexec/afsd ${afsd_flags}
1.90 art 442: echo ' done.'
443: fi
444:
1.266 millert 445: if [ X"${check_quotas}" = X"YES" ]; then
1.41 downsj 446: echo -n 'checking quotas:'
447: quotacheck -a
448: echo ' done.'
449: quotaon -a
450: fi
1.1 deraadt 451:
452: # build ps databases
1.95 deraadt 453: echo -n 'building ps databases:'
454: echo -n " kvm"
1.88 millert 455: kvm_mkdb
1.95 deraadt 456: echo -n " dev"
1.1 deraadt 457: dev_mkdb
1.95 deraadt 458: echo "."
1.1 deraadt 459:
1.101 deraadt 460: chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
1.226 millert 461: chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
1.1 deraadt 462:
463: # check the password temp/lock file
1.17 deraadt 464: if [ -f /etc/ptmp ]; then
1.1 deraadt 465: logger -s -p auth.err \
466: 'password file may be incorrect -- /etc/ptmp exists'
1.32 deraadt 467: fi
468:
1.49 millert 469: echo clearing /tmp
470:
471: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
472: # (not needed with mfs /tmp, but doesn't hurt there...)
473: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
474: find . ! -name . ! -name lost+found ! -name quota.user \
1.103 millert 475: ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
1.49 millert 476:
1.256 henning 477: # create Unix sockets directories for X if needed and make sure they have
1.203 hugh 478: # correct permissions
1.210 henning 479: if [ -d /usr/X11R6/lib ]; then
1.203 hugh 480: for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
1.210 henning 481: if [ -d $d ]; then
1.203 hugh 482: if [ `ls -ld $d | cut -d' ' -f4` != root ]; then
483: chown root $d
484: fi
485: if [ `ls -ld $d | cut -d' ' -f1` != drwxrwxrwt ]; then
486: chmod 1777 $d
487: fi
488: elif [ -e $d ]; then
489: echo "Error: $d exists and isn't a directory."
490: else
491: mkdir -m 1777 $d
492: fi
493: done
494: fi
495:
1.72 deraadt 496: [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel
1.266 millert 497: if [ X"${securelevel}" != X"" ]; then
1.33 millert 498: echo -n 'setting kernel security level: '
1.234 jmc 499: sysctl kern.securelevel=${securelevel}
1.1 deraadt 500: fi
501:
1.34 deraadt 502: # patch /etc/motd
503: if [ ! -f /etc/motd ]; then
504: install -c -o root -g wheel -m 664 /dev/null /etc/motd
505: fi
1.131 millert 506: T=`mktemp /tmp/_motd.XXXXXXXXXX`
1.105 millert 507: if [ $? -eq 0 ]; then
1.102 millert 508: sysctl -n kern.version | sed 1q > $T
509: echo "" >> $T
510: sed '1,/^$/d' < /etc/motd >> $T
511: cmp -s $T /etc/motd || cp $T /etc/motd
512: rm -f $T
513: fi
1.34 deraadt 514:
1.298 ajacouto 515: if [ X"${accounting}" = X"YES" ]; then
516: if [ ! -f /var/account/acct ]; then
517: touch /var/account/acct
518: fi
1.1 deraadt 519: echo 'turning on accounting'; accton /var/account/acct
520: fi
521:
1.115 deraadt 522: if [ -f /sbin/ldconfig ]; then
523: echo 'creating runtime link editor directory cache.'
524: if [ -d /usr/local/lib ]; then
1.183 todd 525: shlib_dirs="/usr/local/lib $shlib_dirs"
1.115 deraadt 526: fi
527: if [ -d /usr/X11R6/lib ]; then
1.183 todd 528: shlib_dirs="/usr/X11R6/lib $shlib_dirs"
1.115 deraadt 529: fi
530: ldconfig $shlib_dirs
1.231 millert 531: fi
532:
533: if [ -x /usr/libexec/vi.recover ]; then
1.314 jasper 534: echo 'preserving editor files.'; /usr/libexec/vi.recover
1.115 deraadt 535: fi
536:
1.189 deraadt 537: if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
1.133 deraadt 538: echo -n "ssh-keygen: generating new DSA host key... "
1.189 deraadt 539: if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
1.163 deraadt 540: echo done.
541: else
542: echo failed.
543: fi
544: fi
1.189 deraadt 545: if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
1.163 deraadt 546: echo -n "ssh-keygen: generating new RSA host key... "
1.189 deraadt 547: if /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''; then
1.133 deraadt 548: echo done.
549: else
550: echo failed.
551: fi
552: fi
1.189 deraadt 553: if [ ! -f /etc/ssh/ssh_host_key ]; then
1.187 markus 554: echo -n "ssh-keygen: generating new RSA1 host key... "
1.189 deraadt 555: if /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N ''; then
1.244 markus 556: echo done.
557: else
558: echo failed.
559: fi
560: fi
561:
562: if [ ! -f /etc/isakmpd/private/local.key ]; then
563: echo -n "openssl: generating new isakmpd RSA key... "
564: if /usr/sbin/openssl genrsa -out /etc/isakmpd/private/local.key 1024 \
565: > /dev/null 2>&1; then
566: chmod 600 /etc/isakmpd/private/local.key
1.295 mcbride 567: openssl rsa -out /etc/isakmpd/local.pub \
1.244 markus 568: -in /etc/isakmpd/private/local.key -pubout > /dev/null 2>&1
1.114 deraadt 569: echo done.
570: else
571: echo failed.
572: fi
573: fi
574:
1.1 deraadt 575: echo -n starting network daemons:
1.311 reyk 576:
577: if [ X"${snmpd_flags}" != X"NO" ]; then
578: echo -n ' snmpd'; /usr/sbin/snmpd $snmpd_flags
1.292 norby 579: fi
580:
581: if [ X"${ripd_flags}" != X"NO" ]; then
582: echo -n ' ripd'; /usr/sbin/ripd $ripd_flags
1.1 deraadt 583: fi
584:
1.266 millert 585: if [ X"${mrouted_flags}" != X"NO" ]; then
1.4 deraadt 586: echo -n ' mrouted'; mrouted $mrouted_flags
1.284 norby 587: fi
588:
589: if [ X"${dvmrpd_flags}" != X"NO" ]; then
590: echo -n ' dvmrpd'; /usr/sbin/dvmrpd $dvmrpd_flags
1.262 henning 591: fi
592:
1.266 millert 593: if [ X"${ospfd_flags}" != X"NO" ]; then
1.262 henning 594: echo -n ' ospfd'; /usr/sbin/ospfd $ospfd_flags
1.305 norby 595: fi
596:
597: if [ X"${ospf6d_flags}" != X"NO" ]; then
598: echo -n ' ospf6d'; /usr/sbin/ospf6d $ospf6d_flags
1.239 henning 599: fi
600:
1.266 millert 601: if [ X"${bgpd_flags}" != X"NO" ]; then
1.239 henning 602: echo -n ' bgpd'; /usr/sbin/bgpd $bgpd_flags
1.291 mpf 603: fi
604:
605: if [ X"${ifstated_flags}" != X"NO" ]; then
606: echo -n ' ifstated'; ifstated $ifstated_flags
1.297 pyr 607: fi
608:
1.308 deraadt 609: if [ X"${relayd_flags}" != X"NO" ]; then
610: echo -n ' relayd'; /usr/sbin/relayd $relayd_flags
1.4 deraadt 611: fi
1.1 deraadt 612:
1.266 millert 613: if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
1.86 form 614: touch /var/db/dhcpd.leases
1.315 jdixon 615: echo -n ' dhcpd'; /usr/sbin/dhcpd ${dhcpd_flags}
1.285 norby 616: fi
617:
618: if [ X"${dhcrelay_flags}" != X"NO" ]; then
619: echo -n ' dhcrelay'; /usr/sbin/dhcrelay $dhcrelay_flags
1.127 itojun 620: fi
621:
622: if ifconfig lo0 inet6 >/dev/null 2>&1; then
623: fw=`sysctl -n net.inet6.ip6.forwarding`
1.266 millert 624: if [ X"${fw}" = X"0" ]; then
625: if [ X"${rtsold_flags}" != X"NO" ]; then
1.127 itojun 626: echo -n ' rtsold'
627: /usr/sbin/rtsold ${rtsold_flags}
628: fi
629: else
1.266 millert 630: if [ X"${route6d_flags}" != X"NO" ]; then
1.127 itojun 631: echo -n ' route6d'
632: /usr/sbin/route6d ${route6d_flags}
633: fi
1.266 millert 634: if [ X"${rtadvd_flags}" != X"NO" ]; then
1.127 itojun 635: echo -n ' rtadvd'
636: /usr/sbin/rtadvd ${rtadvd_flags}
637: fi
638: fi
1.281 reyk 639: fi
640:
641: if [ X"${hostapd_flags}" != X"NO" ]; then
642: echo -n ' hostapd'; /usr/sbin/hostapd ${hostapd_flags};
1.86 form 643: fi
644:
1.266 millert 645: if [ X"${rwhod}" = X"YES" ]; then
1.1 deraadt 646: echo -n ' rwhod'; rwhod
647: fi
648:
1.23 deraadt 649:
1.266 millert 650: if [ X"${lpd_flags}" != X"NO" ]; then
1.272 fgsch 651: echo -n ' lpd'; lpd ${lpd_flags}
1.23 deraadt 652: fi
1.1 deraadt 653:
1.288 markus 654: # We call sendmail with a full path so that SIGHUP works.
655: # Note that /usr/sbin/sendmail may actually call a
1.154 millert 656: # mailer other than sendmail, depending on /etc/mailer.conf.
1.266 millert 657: if [ X"${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
1.153 millert 658: echo -n ' sendmail'; ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
1.212 deraadt 659: fi
660:
1.266 millert 661: if [ X"${httpd_flags}" != X"NO" ]; then
1.143 espie 662: # Clean up left-over httpd locks
663: rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
1.160 angelos 664: echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags}
1.93 downsj 665: fi
666:
1.266 millert 667: if [ X"${ftpd_flags}" != X"NO" ]; then
1.93 downsj 668: echo -n ' ftpd'; /usr/libexec/ftpd ${ftpd_flags}
1.275 camield 669: fi
670:
671: if [ X"${ftpproxy_flags}" != X"NO" ]; then
672: echo -n ' ftp-proxy'; /usr/sbin/ftp-proxy ${ftpproxy_flags}
1.124 fgsch 673: fi
674:
1.266 millert 675: if [ X"${identd_flags}" != X"NO" ]; then
1.124 fgsch 676: echo -n ' identd'; /usr/libexec/identd ${identd_flags}
1.1 deraadt 677: fi
678:
1.266 millert 679: if [ X"${inetd}" = X"YES" -a -e /etc/inetd.conf ]; then
1.23 deraadt 680: echo -n ' inetd'; inetd
1.237 deraadt 681: fi
682:
683: if [ X"${sshd_flags}" != X"NO" ]; then
684: echo -n ' sshd'; /usr/sbin/sshd ${sshd_flags};
1.238 deraadt 685: fi
686:
1.266 millert 687: if [ X"${spamd_flags}" != X"NO" ]; then
1.300 beck 688: if [ X"${spamd_black}" != X"NO" ]; then
1.299 beck 689: spamd_flags="${spamd_flags} -b"
1.238 deraadt 690: fi
1.242 otto 691: echo -n ' spamd'; eval /usr/libexec/spamd ${spamd_flags}
1.238 deraadt 692: /usr/libexec/spamd-setup
1.301 beck 693: if [ X"${spamd_black}" = X"NO" ]; then
1.238 deraadt 694: echo -n ' spamlogd'
1.259 henning 695: /usr/libexec/spamlogd ${spamlogd_flags}
1.238 deraadt 696: fi
1.23 deraadt 697: fi
1.1 deraadt 698:
1.266 millert 699: if [ X"${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
1.1 deraadt 700: echo -n ' rarpd'; rarpd ${rarpd_flags}
701: fi
702:
1.266 millert 703: if [ X"${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
1.1 deraadt 704: echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags}
705: fi
706:
1.266 millert 707: if [ X"${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
1.1 deraadt 708: echo -n ' rbootd'; rbootd ${rbootd_flags}
1.56 maja 709: fi
710:
1.266 millert 711: if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
1.56 maja 712: echo -n ' mopd'; mopd ${mopd_flags}
1.1 deraadt 713: fi
714:
715: echo '.'
1.277 deraadt 716:
717: mixerctl_conf
1.175 hin 718:
719: # KerberosV master KDC
1.266 millert 720: if [ X"${krb5_master_kdc}" = X"YES" ]; then
1.175 hin 721: echo 'KerberosV master KDC'
722: /usr/libexec/kdc &
723: /usr/libexec/kadmind &
724: /usr/libexec/kpasswdd &
725: fi
726:
727: # KerberosV slave KDC
1.266 millert 728: if [ X"${krb5_slave_kdc}" = X"YES" ]; then
1.175 hin 729: echo 'KerberosV slave KDC'
730: /usr/libexec/kdc &
731: # Remember to enable hpropd in inetd.conf
1.17 deraadt 732: fi
733:
1.72 deraadt 734: [ -f /etc/rc.local ] && . /etc/rc.local
1.73 millert 735:
736: echo -n standard daemons:
1.87 marc 737:
1.266 millert 738: if [ X"${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then
1.230 deraadt 739: echo -n ' apmd'; /usr/sbin/apmd ${apmd_flags}
1.229 henning 740: fi
741:
742: if [ X"${sensorsd_flags}" != X"NO" ]; then
743: echo -n ' sensorsd'; /usr/sbin/sensorsd ${sensorsd_flags}
1.248 grange 744: fi
745:
746: if [ X"${hotplugd_flags}" != X"NO" -a -x /usr/sbin/hotplugd ]; then
747: echo -n ' hotplugd'; /usr/sbin/hotplugd ${hotplugd_flags}
1.274 henning 748: fi
749:
750: if [ X"${watchdogd_flags}" != X"NO" -a -x /usr/sbin/watchdogd ]; then
751: echo -n ' watchdogd'; /usr/sbin/watchdogd ${watchdogd_flags}
1.87 marc 752: fi
753:
1.73 millert 754: echo -n ' cron'; cron
1.87 marc 755:
1.286 mcbride 756: # disable carp interlock
1.289 henning 757: ifconfig -g carp -carpdemote 128
1.286 mcbride 758:
1.73 millert 759: echo '.'
1.1 deraadt 760:
761: date
1.71 deraadt 762:
1.266 millert 763: if [ X"${wsmoused_flags}" != X"NO" -a -x /usr/sbin/wsmoused ]; then
1.169 deraadt 764: echo 'starting wsmoused...'; /usr/sbin/wsmoused ${wsmoused_flags}
1.155 aaron 765: fi
766:
1.71 deraadt 767: # Alternatively, on some architectures, xdm may be started in /etc/ttys.
1.266 millert 768: if [ X"${xdm_flags}" != X"NO" ]; then
1.92 downsj 769: echo 'starting xdm...'; /usr/X11R6/bin/xdm ${xdm_flags}
1.71 deraadt 770: fi
1.286 mcbride 771:
1.1 deraadt 772: exit 0