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