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