History log of /openbsd-current/etc/rc
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.575 17-May-2024 deraadt

run the sshd-session link kit also


# 1.574 02-Apr-2024 deraadt

also relink ssh-agent


# 1.573 30-Mar-2024 deraadt

program relinking currently uses a Makefile.relink inside the re-link kit.
For sshd (the only relinked program at the moment), this file is created
in an extremely nasty way. It'll be better if we have a proper clean
install.sh script, which I've built for sshd. But let's first commit the
change to /etc/rc which will handle that in the near future.
ok djm


Revision tags: OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.572 01-Oct-2023 naddy

show fingerprint of freshly generated ssh host key on first boot

Print to the console the fingerprint of a newly generated ssh host
key of the preferred type (currently ED25519), typically when booting
for the first time. This simplifies a secure first ssh connection to
a freshly installed machine.

ok deraadt@ kn@, and various for earlier iterations


# 1.571 26-Apr-2023 phessler

During boot we have a protective and restrictive pf ruleset during the time
we are running netstart, and then load the pf.conf ruleset after all of the
interfaces are loaded.

Allow in and out IPv6 neighbor advertisement traffic without state during
that time.

suggestions/OK from saschan@
OK sthen@ kn@ florian@ deraadt@


Revision tags: OPENBSD_7_3_BASE
# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.574 02-Apr-2024 deraadt

also relink ssh-agent


# 1.573 30-Mar-2024 deraadt

program relinking currently uses a Makefile.relink inside the re-link kit.
For sshd (the only relinked program at the moment), this file is created
in an extremely nasty way. It'll be better if we have a proper clean
install.sh script, which I've built for sshd. But let's first commit the
change to /etc/rc which will handle that in the near future.
ok djm


Revision tags: OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.572 01-Oct-2023 naddy

show fingerprint of freshly generated ssh host key on first boot

Print to the console the fingerprint of a newly generated ssh host
key of the preferred type (currently ED25519), typically when booting
for the first time. This simplifies a secure first ssh connection to
a freshly installed machine.

ok deraadt@ kn@, and various for earlier iterations


# 1.571 26-Apr-2023 phessler

During boot we have a protective and restrictive pf ruleset during the time
we are running netstart, and then load the pf.conf ruleset after all of the
interfaces are loaded.

Allow in and out IPv6 neighbor advertisement traffic without state during
that time.

suggestions/OK from saschan@
OK sthen@ kn@ florian@ deraadt@


Revision tags: OPENBSD_7_3_BASE
# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.573 30-Mar-2024 deraadt

program relinking currently uses a Makefile.relink inside the re-link kit.
For sshd (the only relinked program at the moment), this file is created
in an extremely nasty way. It'll be better if we have a proper clean
install.sh script, which I've built for sshd. But let's first commit the
change to /etc/rc which will handle that in the near future.
ok djm


Revision tags: OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.572 01-Oct-2023 naddy

show fingerprint of freshly generated ssh host key on first boot

Print to the console the fingerprint of a newly generated ssh host
key of the preferred type (currently ED25519), typically when booting
for the first time. This simplifies a secure first ssh connection to
a freshly installed machine.

ok deraadt@ kn@, and various for earlier iterations


# 1.571 26-Apr-2023 phessler

During boot we have a protective and restrictive pf ruleset during the time
we are running netstart, and then load the pf.conf ruleset after all of the
interfaces are loaded.

Allow in and out IPv6 neighbor advertisement traffic without state during
that time.

suggestions/OK from saschan@
OK sthen@ kn@ florian@ deraadt@


Revision tags: OPENBSD_7_3_BASE
# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.572 01-Oct-2023 naddy

show fingerprint of freshly generated ssh host key on first boot

Print to the console the fingerprint of a newly generated ssh host
key of the preferred type (currently ED25519), typically when booting
for the first time. This simplifies a secure first ssh connection to
a freshly installed machine.

ok deraadt@ kn@, and various for earlier iterations


# 1.571 26-Apr-2023 phessler

During boot we have a protective and restrictive pf ruleset during the time
we are running netstart, and then load the pf.conf ruleset after all of the
interfaces are loaded.

Allow in and out IPv6 neighbor advertisement traffic without state during
that time.

suggestions/OK from saschan@
OK sthen@ kn@ florian@ deraadt@


Revision tags: OPENBSD_7_3_BASE
# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.571 26-Apr-2023 phessler

During boot we have a protective and restrictive pf ruleset during the time
we are running netstart, and then load the pf.conf ruleset after all of the
interfaces are loaded.

Allow in and out IPv6 neighbor advertisement traffic without state during
that time.

suggestions/OK from saschan@
OK sthen@ kn@ florian@ deraadt@


Revision tags: OPENBSD_7_3_BASE
# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.570 25-Jan-2023 asou

Delete TAB only line.


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.569 18-Jan-2023 deraadt

process the sshd random-relink kit if it is found. sshd's text segment
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.568 28-Dec-2022 kn

Make wait_reorder_libs() honour library_aslr=NO

Otherwise it will unconditionally print an empty line in case relinking
is disabled.

Reported by kettenis
Feedback OK tb
OK florian


# 1.567 26-Dec-2022 kn

add newline missed in previous


# 1.566 26-Dec-2022 florian

Re-order libraries in parallel to netstart.

While netstart is busy setting up the network and waiting for a
default route we can already start with reordering libraries since
this does not depend on running network, speeding things up.

Idea & input deraadt
Input & OK kn


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.565 28-Nov-2022 cheloha

rc(8): reorder_libs: print names of relinked libraries

When booting from slow media, the boot can appear to stall at the
"reordering libs" line for quite some time. For my example, my G4
PowerMac booting from USB 1.1 takes a full minute to reorder the
libraries.

Let's print the name of each library before it is relinked. This
gives the operator a better sense of what the machine is doing. In
particular, it signals to the operator that the machine did not hang.

With input from kn@, deraadt@. Positive feedback from sthen@.

Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2

ok kn@


Revision tags: OPENBSD_7_2_BASE
# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.564 29-Aug-2022 deraadt

mount /usr earlier, to satisfy dynamically-linked daemons in /sbin better
(there will be more soon)


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.563 28-Jul-2022 miod

Only attempt to set the yp domainname if not yet set; gets rid of an error
message at shutdown.

tweaks & ok deraadt@


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.562 27-Jul-2022 deraadt

Place ypldap with ypserv, inside the $domainname check, since it also
has the same requirement.


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.561 17-Jul-2022 deraadt

/var/run/ypbind.lock doesn't need to be forcefully removed
ok aja


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.560 11-Jul-2022 tobhe

Generate P-256 ECDH keys for iked instead of reusing 2048 bit RSA keys
from isakmpd.

ok bluhm@


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.559 28-Jun-2022 claudio

Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script and
all the other rc plumbing.
OK deraadt@


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.558 26-Jun-2022 florian

Wait for autoconf interfaces to come up in netstart(8) instead of
rc(8). This makes tunnel interfaces work that depend on working
autoconf interfaces.
OK deraadt


# 1.557 26-Jun-2022 florian

Start network auto configuration daemons earlier so that tunnel
interfaces can depend on dhcp or slaac.
dhcpleased needs /var mounted so pull that up, we do not support /var
on nfs.
With & OK deraadt, earlier version OK sthen


Revision tags: OPENBSD_7_1_BASE
# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.556 17-Jan-2022 jsg

filessystems -> filesystems


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.555 11-Nov-2021 claudio

switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@


Revision tags: OPENBSD_7_0_BASE
# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.554 01-Sep-2021 deraadt

quietly attempt mounting of /var/log early, in case someone creates such
a partition to avoid /var overflow issues
ok benno beck


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.553 28-Jul-2021 deraadt

A slightly less precise match on the ifconfig output lines works
better for rdomain or metric tuned interfaces
from leon fischer


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.552 22-Jul-2021 deraadt

Only perform the default-route-pause if there are interfaces with the
AUTOCONF flag set. This removes the delay for even more (strange)
static configs.
ok sthen


# 1.551 22-Jul-2021 sthen

small tweak for default route checking, we don't care about the number of
routes, only if at least one exists, so can avoid the subshell and just use
grep -q. ok deraadt


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.550 22-Jul-2021 deraadt

After netstart, dhcpleased, and resolved are running, spin up to 10
seconds waiting for a default route (v4 or v6) to exist, this
increases the chance of DNS lookups working earlier. This is done
before pf is configured, sorry we have good reasons. Static
configurations are unaffected. dhclient previously did this kind of
delay, and this is the lightest touch we can come up with which gives
the same effect.
While here, also start relinking earlier.
ok benno florian sthen


Revision tags: OPENBSD_6_9_BASE
# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.549 13-Mar-2021 deraadt

because the kernel has been replaced after last boot, run kvm_mkdb
before the first consumer of kvm_bsd.db


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.548 09-Mar-2021 deraadt

dhcpleased wants /var (but contains code to handle when it isn't there).
But in the nfs diskless case, we can do better by starting it a little
later. This disrupts nfs diskless on dynamic addresses a little, if it ever
actually worked with dhclient, but anyone doing that deserves the headache.
ok florian


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.547 26-Feb-2021 kn

Ship resolvd service, enable it by default

Starting right after unwind.

OK deraadt


# 1.546 26-Feb-2021 florian

rc(8) bits for dhcpleased(8).
OK deraadt


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.545 09-Feb-2021 naddy

rc: ensure that vfs.mounts.nfs check works without NFS

If NFS isn't compiled into the kernel, sysctl -n vfs.mounts.nfs
will produce no numerical output. Make sure that we always have
a valid arithmetic expression.

Reported by and ok patrick@


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.544 29-Nov-2020 deraadt

Add support for !command to mygate, so that netstart has a late opportunity
to perform network configuration (for example, "!route source -ifp em0")
Split mygate and myname manual pages (how did anyone ever believe these
are related), and perform hostname configuration much earlier in rc.
discussed with benno, claudio, jmc, etc etc, last version of !command
parser by tb


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.543 24-Jan-2020 tedu

retire rebound etc bits to the attic


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.542 11-Nov-2019 deraadt

move /usr and var remounting (nfs diskless case...) earlier, so that
unwind can be started (silently) before pf is configured (for those
few weirdos who use hostnames in pf.conf...). Other unidentified concerns
may be improved by this startup re-ordering, so let's give it a try.
discussed with florian.


# 1.541 10-Nov-2019 naddy

use $(<file) instead of $(cat file) since this script uses ksh; ok ajacoutot@


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.540 06-Nov-2019 deraadt

we have emergency entropy injection code in rc, for if the bootblocks and
other methods failed to inject/churn the rng enough. Move it up far earlier.
ok naddy sthen kettenis


Revision tags: OPENBSD_6_6_BASE
# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.539 06-Oct-2019 sthen

for now, only mix in sysctl hw.{uuid,serialno,sensors} to /dev/random.
as found the hard way by d.rauschenb@gmail on an old fujitsu siemens
machine, reading all of hw (notable hw.setperf) can have unexpected
side-effects. ok deraadt


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.538 02-Oct-2019 sthen

feed "sysctl hw" into /dev/random; a cheap way to feed in sensor data
as a one-shot at boot without more complex kernel work, and also includes
some serial numbers/guids which may add a little more entropy e.g. for
systems where /etc/random.seed may be known (e.g. cloned disk images).
"why not" deraadt@


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.537 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_5_BASE
# 1.536 01-Apr-2019 tedu

revert previous. ifconfig errors may be interesting... to be revisited.


# 1.535 01-Apr-2019 tedu

catch/hide errors from ifconfig carp in case there is no carp.
ok deraadt


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.534 24-Feb-2019 kn

Remove -S from install commands

As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and
install(1) will always create files safely, thus clean the option usage
from the tree.

Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.533 19-Feb-2019 kn

Simplify NFS check in reorder_libs()

Loop over df(1)'s output directly, ensure the resulting list of block
devices is unique to avoid later duplicity checks and redundant mount(8)
invocations.

This allows direct bail out on invalid types and simpler saving for later
remount.

OK deraadt


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.532 26-Jan-2019 florian

rc(8) bits for unwind(8); OK deraadt


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.531 24-Jan-2019 ajacoutot

Drop the ttyflags message.
suggested by and ok deraadt@ ("I think we never hang there anymore")


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.530 12-Jan-2019 kettenis

Use acpidump -q to avoid message about ACPI information not being found.
Many arm64 systems use device trees instead of ACPI and acpidump is
expectected to fail on those systems. And vmm(4) doesn't provide ACPI
information either.

ok deraadt@


Revision tags: OPENBSD_6_4_BASE
# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.529 23-Jul-2018 florian

It's time to switch to rad(8); tested by many.
Remove rtadvd(8) from rc(8).
OK deraadt, phessler


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.528 12-Jul-2018 florian

rc(8) infrastructure for rad


# 1.527 11-Jul-2018 sthen

Explicitly call "/etc/rc.d/vmd stop". This issues graceful shutdown commands
to running VMs (at least for OpenBSD ones), but the stop routine for system
daemons is not usually called at shutdown.

Earlier version with just "vmd stop" ok reyk@ kn@, ajacoutot@ reminded me
to hide the contextless "vmd(ok)" text which looks bad, I did so and wrapped
it with a "stopping VMs" message (it can take some time, especially when you
have multiple VMs, so better to have some clear feedback).


# 1.526 11-Jul-2018 florian

Don't hide errors when IPv6 forwarding is not enabled.
OK(failed) phessler
OK deraadt


Revision tags: OPENBSD_6_3_BASE
# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.525 18-Feb-2018 rpe

Remove unecessary line continuation markers after || and &&


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.524 10-Feb-2018 florian

Load RFC 7217 key material and generate if it does not already exist.

Add soii.key to changelist (pointed out by semarie) and mtree/special
(suggest by Craig Skinner).

OK naddy, sthen, rpe, tb


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.523 09-Nov-2017 tb

kill trailing whitespace introduced in previous commit


# 1.522 06-Nov-2017 rpe

Use a variable for /usr/share/relink

OK tb@


# 1.521 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


# 1.520 25-Oct-2017 bluhm

Partially revert rev 1.457 of /etc/rc. The pipe introduced in
sysctl_conf() spawns a subshell. This prevents that the new process
limits affect the daemons started during boot.
OK rpe@ halex@


# 1.519 12-Oct-2017 rpe

The testprogram for ld.so reordering is executed in tmpdir.
Move tmpdir for reordering library from /tmp to /usr/lib.
This allows to have /tmp mounted noexec.

prompted by reports on misc@
OK deraadt@ tj@ tb@


# 1.518 10-Oct-2017 rpe

Move comment line and spacing.


Revision tags: OPENBSD_6_2_BASE
# 1.517 29-Aug-2017 rpe

Based on previous work from deraadt, add relinking of ld.so to
reorder_libs() resulting in a unique ld.so on every system start.

Idea from and OK deraadt@
OK tb@


# 1.516 28-Aug-2017 ajacoutot

Display that we are running the upgrade scripts when they exist. On slowish
machines, running sysmerge(8) can take a little while so don't let people
wonder about why the output seems stuck.

ok sthen@ tb@ rpe@


# 1.515 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.514 20-Aug-2017 rpe

Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.

OK aja@ tb@


# 1.513 18-Jul-2017 zhuk

Use a bit better idiom to get most recent version of the library
being reordered.

okay tb@ deraadt@


# 1.512 18-Jul-2017 rpe

Use numerical sysctl output to check for nfs mounts.

OK tb@


# 1.511 17-Jul-2017 rpe

Tweak previous.


# 1.510 17-Jul-2017 rpe

Use a more compact way to compose the initial pf ruleset.

Diff from Klemens Nanni
OK tb@ zhuk@


# 1.509 17-Jul-2017 tb

Now that choosing the library versions is much faster, we can do
it after remounting the filesystem containing /usr/lib as rw:
the former is pointless if the latter should happen to fail.

From Klemens Nanni
ok rpe


# 1.508 17-Jul-2017 tb

Optimize and simplify the selection of the latest library version in
reorder_libs().

From Klemens Nanni with input from rpe.
ok rpe, zhuk


# 1.507 04-Jul-2017 rpe

Switch reorder_kernel() from sending emails to logging via syslog
and to write the logfile inside the kernel compile dir.

- turn the whole reorder_kernel function into a subshell {} -> ()
- create kernel compile dir early on
- redirect all stdout/stderr to a logfile inside this dir
- setup ERR trap handler that
- disables the EXIT trap handler
- syslogs the error and hints to the logfile
- additionally sends this message to the console
- setup EXIT trap handler that syslogs success
- wipe only the content instead of the whole kernel compile dir
- reestablish stdout redirection to the log after the wipe
- remove -q option of sha256 to log check result
- run reorder_kernel() in the background

OK deraadt@ tb@


# 1.506 30-Jun-2017 rpe

Improve reorder_kernel()

- check for and exit if /usr/share is on a nfs mounted filesystem
- add trap handlers that mail the logfile to the admin user
- use $_compile instead of $_compile_dir like in the installer
- use $_compile/$_kernel instead of $_kernel_dir
- remove the now redundant sha256 -h ... after make newinstall
- write stdout/stderr of the background subshell to a logfile

OK tb@ deraadt@


# 1.505 27-Jun-2017 tedu

remove some old cruft.


# 1.504 22-Jun-2017 deraadt

Adjust relink procedure to use new targets. Better use semantics for
users and developers.
diff from rpe, ok tb


# 1.503 19-Jun-2017 deraadt

As early as possible, create a link /bsd.booted to the /bsd kernel we
presume we booted from. If you boot from another kernel, we cannot help
you later with hibernate, sorry -- The kernel does not get a useable
filename from the bootblocks.

In the bootblocks, detect a live hibernate signature and boot from
/bsd.booted instead.

with yasuoka, lots of discussion with mlarkin, ok tom


# 1.502 14-Jun-2017 rpe

Add a new function reorder_kernel() that relinks and installs the
new kernel in the background on system startup. It stores the hash
of the new kernel and sends a notification email to the admin or
root user. If it finds /usr/share/compile.tgz, it removes the
existing compile dir and replaces it with the content of (new)
archive. If the hash of /bsd does not match the stored one, no
relinking happens.

Idea from, joint work with and OK deraadt@
OK tb@ halex@
unnoticed by many


# 1.501 06-Jun-2017 florian

start slaacd as early as possible, right after pf and sysctl.conf are
setup.
Input & OK deraadt@


# 1.500 03-Jun-2017 deraadt

We have been running a small awk program before installing the relinked libc.
Perform the same kind of test for relinked libcrypto, using an openssl
sequence (proposed by sthen)


# 1.499 03-Jun-2017 deraadt

Immediately after mounting / read-write, chmod og-rwx the kernel. Remote
prying eyes were already been hindered at determining kernel addresses, now
local prying eyes are also hindered.
ok tb rpe


# 1.498 30-May-2017 tb

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot


# 1.497 29-May-2017 florian

rc.d(8) for slaacd
OK phessler, deraadt


# 1.496 29-May-2017 deraadt

Randomize link-order of libcrypto as we do with libc. This library
has many small functions without significant local storage, therefore
less tail protection from -fstack-protector-strong to prevent their use
as ROP gadgets. It is used in security contexts. Also many functions
dribble pointers onto the stack, allowing discovery of gadgets via the
fixed relative addresses, so let's randomly bias those.
ok tedu jsing

The rc script will soon need a strategy for skipping this step on
machines with poor IO performance. Or maybe do it less often? However,
I don't see many more libraries we'll do this with, these are the two
most important ones.


# 1.495 01-May-2017 rpe

Comments and spacing.


# 1.494 18-Apr-2017 schwarze

Simplify patching of motd(5), also making it agree better with the
documentation if the first line of the file is blank.
Quirk reported by Anthony Coulter <bsd at anthonycoulter dot name>.
OK rpe@


Revision tags: OPENBSD_6_1_BASE
# 1.493 26-Feb-2017 matthieu

Switch to xenodm(1).

Do it now deraadt@


# 1.492 27-Dec-2016 jca

Remove user uucp and group news from base.


# 1.491 04-Nov-2016 rpe

spacing


# 1.490 07-Oct-2016 otto

first set -max limit, then -cur, otherwise if -cur si higher than the current
max, it won't be set. noted by Evgeny Grin; ok millert@


# 1.489 06-Oct-2016 reyk

Add switchd

OK deraadt@


# 1.488 06-Oct-2016 reyk

Move vmd down as VMs might need the host's dhcpd, httpd etc. on startup.

OK mlarkin@ deraadt@


# 1.487 27-Sep-2016 rpe

Run acpidump(8) at system startup and store ACPI tables in the
/var/db/acpi directory. Later sendbug(1) will use this data in
bug reports. That directory is created by mtree.

idea from and OK deraadt
OK kettenis


Revision tags: OPENBSD_6_0_BASE
# 1.486 10-Jul-2016 rpe

Fix detection of /usr/lib on NFS.
Found by Frank Scheiner, thanks for reporting this.

OK krw, halex
'cool' deraadt


# 1.485 29-May-2016 rpe

Improve error handling in reorder_libs()

- run commands in subshell only if mktemp is successful
- on error just leave the for-loop but set _error=true
- cleanup tmpdirs afterwards
- set _error=true if the ro remount fails
- print appropriate final message depending on $_error

positive feedback from deraadt
OK krw


# 1.484 27-May-2016 rpe

No need to show the messages if we skip in case of /usr/lib on nfs.

OK deraadt


# 1.483 27-May-2016 rpe

Add function comments.

OK sthen, deraadt


# 1.482 26-May-2016 deraadt

whitespace found during review


# 1.481 26-May-2016 rpe

- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system

OK deraadt


# 1.480 22-May-2016 rpe

Use the -F flag of install(1) to ensure the file's content is flushed to disk.

OK deraadt


# 1.479 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


# 1.478 05-May-2016 sthen

show what we're doing when reordering libraries, otherwise the text
above it is "starting network", which can make you think something is
broken when your machine is as slow as some of mine.

"Yeah, that's a pretty crappy machine" deraadt@


# 1.477 27-Apr-2016 ajacoutot

We want to run sysmerge(8) a bit earlier in the boot process so that it has a
chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime

discussed with deraadt@
ok deraadt@ rpe@


# 1.476 27-Apr-2016 rpe

Use 'sort -V' which is actually meant to sort version numbers.

Noted by zhuk@
OK deraadt@


# 1.475 26-Apr-2016 deraadt

Re-link (only the newest) libc.so, placing the objects in a random
order.
with shell script assistance from rpe


Revision tags: OPENBSD_5_9_BASE
# 1.474 29-Dec-2015 rpe

Replace single pattern case-blocks with simpler code.

OK halex@


# 1.473 06-Dec-2015 rpe

Add missing rc bits for rebound.

rc-wise OK aja@ jasper@


# 1.472 05-Dec-2015 jasper

add rcscript for vmd

ok mlarkin@
prompted by deraadt@


# 1.471 02-Dec-2015 rpe

Since version 1.467 of /etc/rc, it was no longer possible to add
shlib_dirs using /etc/rc.conf.local.

Fix from Jan Johansson, thanks.

OK krw@, halex@


# 1.470 27-Nov-2015 deraadt

yppasswd went away


# 1.469 10-Nov-2015 tim

Fix typos in comments


# 1.468 01-Nov-2015 rpe

A missed backticks to $() conversion.

OK krw@


# 1.467 18-Oct-2015 rpe

Finish first round of rework of the rc script.

OK krw@ halex@


# 1.466 18-Oct-2015 deraadt

Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja


# 1.465 03-Oct-2015 renato

Enable eigrpd(8) and eigrpctl(8) in the builds

ok deraadt@


# 1.464 29-Sep-2015 rpe

Besides the usual style changes:
- verify that kbd is executable and kbdtype is not empty
- use safer 'print --' to pipe the initial pf ruleset to pfctl
- simplify the ipsecctl if-block

Feedback and OK halex@
OK krw@


# 1.463 13-Sep-2015 rpe

- FOO=bar; export FOO -> export FOO=bar
- run domainname only with a non-empty /etc/defaultdomain file
- Make single-user if-block more intuitive, which also matches
better what the comment actually says

OK halex@, krw@ on a similar diff


# 1.462 13-Sep-2015 rpe

Remove setup_X_sockets():
The creation of Unix sockets directories in /tmp for X happens right
after pruning /tmp. So the whole dance of checking for their
existence, ownership or permissions is not necessary. It's safe to
just create them with the right permissions if X is installed.

Changes to do_fsck():
Remove the _flags variable and pass flags to fsck directly with "$@".

Feedback and OK halex@
OK krw@ on a similar diff


# 1.461 12-Sep-2015 sthen

Provide an ftpproxy6 rc script. ftp-proxy can only open one listening socket
at a time, so a second instance of the daemon is required.

OK mikeb stsp ajacoutot


# 1.460 28-Aug-2015 rpe

Changes for start_daemon():
- use more descriptive variable name

Changes for make_keys():
- use variables for file paths
- key -> keys in message
- take into account the return codes of isakmpd private *and* public
key generation

OK krw@ halex@


# 1.459 22-Aug-2015 rpe

- add usage info
- initialize _ban variable
- style

OK halex@


# 1.458 22-Aug-2015 rpe

Restore previous behaviour for wsconsctl_conf().

In wsconsctl.conf configuration variables can contain doublequotes
which are removed by the shell if wsconsctl is used interactively.

In scripts, without using eval, these doublequotes are preserved
and the wsconsctl command complains about "illegal character in
input".

Found by and OK jmc@
With feedback from and OK krw@, halex@


# 1.457 13-Aug-2015 rpe

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():
- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet

OK krw@, halex@


# 1.456 12-Aug-2015 rpe

Start the rework of the /etc/rc shell script.

General changes:
- apply a similar 'style' as used in the installer scripts
- improve comments to be more to the point, remove where code is obvious
- document usage of functions if they have arguments
- rename variables where it improves readability
- replace really old-school shell code with more contemporary idioms

Changes to stripcom():
- skip empty files (eleminates tests for this before calling stripcom)
- remove {} around the while-loop, feed file directly
- instead of continue if empty and then print, print only if non-empty
- use the safer "print -r --" instead of plain "echo"
- quote "$_line" on output to prevent globbing

Changes to update_limit():
- use {,-cur,-max} instead of "" -cur -max
- eleminate if-block with reverse test and continue

OK halex@ krw@


Revision tags: OPENBSD_5_8_BASE
# 1.455 03-Aug-2015 yasuoka

Place etc/defaults/radiusd.conf and etc/rc.d/radiusd. Modify etc/rc
to hook the rc script and modify etc/rc.conf to make it disable by
default. Also add an entry for /etc/radiusd.conf to etc/changelist
and etc/mtree/special.

ok deraadt


# 1.454 20-Jul-2015 rpe

Disable Strict Bourne shell mode for /etc/rc and /etc/netstart to be
able to use ksh syntax within these scripts. This way init doesn't
need to be changed, which starts /etc/rc using /bin/sh and people
can still use "sh /etc/netstart ifname".

Idea from and OK halex@
OK deraadt@ krw@ guenther@


# 1.453 19-Jul-2015 rpe

Replace test command with [].

OK halex@ krw@


# 1.452 18-Jul-2015 rpe

Put the opening curley brackets on the same line as the function name.

OK krw@ halex@


# 1.451 18-Jul-2015 rpe

- remove trailing blanks introduced in previous commit
- no space in redirections like </foo or >$bar
- few other minor whitespaces

OK krw@


# 1.450 18-Jul-2015 rpe

Improve comments
- Add comments for functions
- Start comments with capital letters
- End comments with a full stop
- Allow comments to extend up to column 80

OK krw@


# 1.449 02-May-2015 ajacoutot

Drop pf_rules and ipsec_rules from rc.conf(5); it shouldn't have been made
tweakable: there's no real point and these files support the 'include' option so
one can always get its config from whatever path... especially useful when
testing a new ruleset.

man page inputs from schwarze@
ok halex@ schwarze@ rpe@ deraadt@


# 1.448 11-Mar-2015 krw

'rc.firstime' -> 'rc.firsttime' in comment.

Diff from Navan Carson via tech@


Revision tags: OPENBSD_5_7_BASE
# 1.447 22-Jan-2015 krw

Use /etc/services names in all the default pf rules (most already
did). This allows any local changes to /etc/services to be effective
if all you have is the default.

Issue pointed out by Brian S. Vangsgaard on bugs@. Thanks!

ok phessler@ deraadt@


# 1.446 03-Dec-2014 florian

Unhook rtsol(8) and rtsold(8) from the build.
OK deraadt@


# 1.445 30-Nov-2014 dcoppa

Fix comment: We don't use RC4 anymore, it's better to be more
generic.

ok miod@


# 1.444 17-Nov-2014 deraadt

Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the
often space-constrained /var filesystem was a historical mistake. There
are big implications for the daemons which assume they won't run out of
space, and this is a first step towards trying to improve the situation.

Move /tmp to the same 7-day expiration rules that /var/tmp had.
vi.recover works just as well as before, except on memory filesystems;
indicating that vi should be repaired to write files into homedirs or
something.

done with rpe
ok many


# 1.443 05-Nov-2014 millert

When clearing /tmp, use "-maxdepth -1" instead of "-type d -prune".
This is easier to understand and fixes a bug where the "-type d -prune"
was misplaced as noticed by pirofti@. OK deraadt@


# 1.442 15-Sep-2014 matthieu

Remove sendmail tentacles. ok krw@ ajacoutot@


# 1.441 26-Aug-2014 robert

usr.sbin


# 1.440 22-Aug-2014 deraadt

disable use of bind in base; in the base use nsd/unbound instead.
a proper & complete bind port will show up.
discussed with many for years


# 1.439 17-Aug-2014 ajacoutot

Execute /etc/netstart using sh(1) instead of sourcing it.
Committing early to make sure we have time to fix any side-effect.

ok deraadt@


Revision tags: OPENBSD_5_6_BASE
# 1.438 04-Aug-2014 naddy

enable httpd; ok deraadt@


# 1.437 19-Jul-2014 bluhm

Print a warning message if the files with the random seed are not
writeable during shutdown. This prevents ugly error messages when
the machine is rebooted from singe-user without mounting the file
systems read-write.
suggested by deraadt@


# 1.436 18-Jul-2014 deraadt

ugly ugly whitespace


# 1.435 17-Jul-2014 deraadt

sh netstart, instead of using .
We don't want any of the variables created inside netstart to infect the
rc script.
ok claudio sthen aja


# 1.434 14-Jul-2014 ajacoutot

quiet /etc/rc.shutdown, it may not exist.

ok deraadt@


# 1.433 14-Jul-2014 ajacoutot

This isn't C.


# 1.432 14-Jul-2014 ajacoutot

Only set kern.securelevel=1 if it was not lowered nor bumped by
rc.securelevel,

with deraadt@


# 1.431 14-Jul-2014 deraadt

rc.{local,securelevel,shutdown} become examples. If versions of them
are created in /etc, they are executed (they used to be sourced) to
avoid polluting the rc variable space. The powerdown= and securelevel=
features are removed; they are likely only used by 2 people. the
secureleve is now always raised; this is the only sensible default.
ok ajacoutot


# 1.430 14-Jul-2014 deraadt

check for existance of rc.shutdown, before sourcing it


# 1.429 13-Jul-2014 claudio

rc bits for iscsid. Start iscsid as early as possible. Use the new -N
flag for fsck and mount to check and mount the iscsi file systems (marked
with option net) right after the mount -a.
"Get it in" deraadt@
rpe@ is OK with this going in but it may need further changes


# 1.428 12-Jul-2014 robert

Make rc.conf a parsed configuration file and stop sourcing it as a shell
script.
From now on rc.conf has a fixed syntax (key=val) and it is not allowed
to add anything to it besides the supported syntax, it all going to be
ignored.

discussed with and help from deraadt@ and halex@


# 1.427 25-Apr-2014 bluhm

Redirecting stderr to /dev/null suppresses all errors. Instead use
the new status=none feature to make dd quiet.
OK halex@


# 1.426 24-Apr-2014 tedu

rm rwhod tentacles


# 1.425 23-Apr-2014 ajacoutot

Remove krb5 bits from rc(8).

ok reyk@


# 1.424 19-Apr-2014 henning

use "!received-on any" to absolutely ensure that we're not forwarding
carp, rpc or nfs traffic in the initial ruleset active during network
startup for a short time (or a much longer time if /etc/pf.conf is
screwed up). ok phessler


# 1.423 15-Mar-2014 sthen

Enable Unbound in base, ok deraadt@


# 1.422 13-Mar-2014 florian

Unhook httpd(8) from build; etc bits
OK krw@, gilles@, lteo@, tedu@, todd@, benno@, sthen@
"The time is right." and much help getting the show on
the road deraadt@


Revision tags: OPENBSD_5_5_BASE
# 1.421 19-Feb-2014 schwarze

Ignore blank characters at the end of ${pkg_scripts} in order
to refrain from trying to execute /etc/rc.d/ in that case.
Problem noticed by jasper@.

Opinions on this patch vary: "much nicer, ok" sthen@
"good god, what horrible shell voodoo, ok" ajacoutot@


# 1.420 19-Jan-2014 claudio

Extend the initial pf ruleset to explicitly allow dhcp / bootp and dhcpv6.
Our dhclient only uses the bpf tap for broadcast packets (which bypass
pf) but lease renewals will use a regular socket and are blocked without
this change. Rules are written so that accidential forwarding of packets
is not possible.
Diff from brad@, OK henning@, benno@, mikeb@


# 1.419 03-Jan-2014 millert

Use kern.securelevel to determine whether or not we are in single
user mode now that init no longer raises securelevel during reboot.
OK deraadt@


# 1.418 28-Dec-2013 deraadt

document a hack we want fixed later


# 1.417 27-Dec-2013 rpe

- add chmod of seedfile in /etc
- use its return code for single/multiuser detection

ok deraadt


# 1.416 27-Dec-2013 rpe

re-use random_seed in shutdown section

ok deraadt


# 1.415 27-Dec-2013 deraadt

create a seed file for the bootloader in /etc/random.seed


# 1.414 27-Dec-2013 deraadt

nest random_seed() contents into a single redirection
idea from rpe


# 1.413 27-Dec-2013 deraadt

re-do shutdown operations. Run the scripts if we may; take down carp
unconditionally, and then do the optional powerdown
discussed at length with rpe


# 1.412 27-Dec-2013 deraadt

when forcing a re-key, might as well toss in dmesg as additional seed
material


# 1.411 27-Dec-2013 deraadt

all the random devices have been the same for a while; so let us avoid
being obtuse and use /dev/random


# 1.410 26-Dec-2013 espie

make absence of pkg_scripts non silent, after nits from theo and halex.
okay rpe@, kirby@


# 1.409 17-Dec-2013 halex

Run spamd-setup from within /etc/rc.d/spamd, and take $spamd_black
into consideration.
Diff from Maurice Janssen, thanks!

ok rpe@ giovanni@


# 1.408 15-Dec-2013 tedu

remove popa3d etc tendrils


# 1.407 09-Aug-2013 ajacoutot

Add rc.d(8) scripts for ipropd-master and ipropd-slave.

ok deraadt@


Revision tags: OPENBSD_5_4_BASE
# 1.406 01-Jun-2013 naddy

hook up slowcgi to the tree, including /etc glue and a sample configuration
snippet; ok florian@


Revision tags: OPENBSD_5_3_BASE
# 1.405 18-Nov-2012 ajacoutot

Remove pointless local declaration.

ok halex@


# 1.404 04-Nov-2012 kettenis

Start ldomd(8).


# 1.403 20-Sep-2012 yasuoka

Enable npppd and npppctl in default build. Add npppd to rc and
install sample configs to /etc/.

ok claudio deraadt henning mcbride


# 1.402 26-Aug-2012 ajacoutot

Hook up nginx to rc(8).

ok deraadt@ robert@


# 1.401 20-Aug-2012 dlg

wire up the bits for tftp-proxy, which is called tftpproxy from rc.d's
point of view.

mostly ok sthen@ ajacoutot@, who were discussing the feng shui of the
start_daemons chunk


Revision tags: OPENBSD_5_2_BASE
# 1.400 06-Apr-2012 jsing

tedu the raidctl.

ok deraadt@


# 1.399 10-Mar-2012 dlg

ypbind likes a ypserv to talk to, and ypldap pretends to be ypserv.
this diff starts ypldap before ypbind instead of after.

ok deraadt@ ajacoutot@


# 1.398 05-Mar-2012 dlg

add tftpd to the network daemons list just after ftpd and ftpproxy.

reminded by mikeb@
ok sthen@


Revision tags: OPENBSD_5_1_BASE
# 1.397 09-Dec-2011 ratchov

Handle aucat -> sndiod name change, and enable sndiod by default. Mostly
from ajacoutot@.

ok deraadt ajacoutot


# 1.396 13-Oct-2011 ajacoutot

Start ldapd(8) earlier so that ypldap(8) can properly run (an LDAP
server _must_ be running and accessible before ypldap is started).

Add a proper pexp in the ypldap rc script.

discussed with pyr@ robert@ deraadt@
ok deraadt@


# 1.395 07-Oct-2011 deraadt

The new ypbind changes requires that the domainname be set before
rc.conf is run. There's no real downside.
ok aja


# 1.394 06-Oct-2011 deraadt

ccd goes to the attic
discussed with jsing and millert


# 1.393 16-Sep-2011 robert

Add a script for popa3d to support running it outside of inetd.


Revision tags: OPENBSD_5_0_BASE
# 1.392 28-Jul-2011 halex

supress empty rc.firsttime email and add hostname to the subject line

ok deraadt krw


# 1.391 20-Jul-2011 halex

remove an unneeded trailing semicolon


# 1.390 20-Jul-2011 halex

cleanup of fill_baddynamic()

ok krw@


# 1.389 19-Jul-2011 deraadt

random seed handling can now be done fairly early, well, as soon as
we are beyond the nfs diskless /var and /usr mounting. Issue also
spotted by Hugo Villeneuve, attempt at repair by me. Let's see how it
works out in practice...
looked at by krw, too


# 1.388 19-Jul-2011 deraadt

Now that fill_baddynamic() is being called much earlier, it cannot use
grep in a NFS diskless environment. Found and fixed by Hugo Villeneuve


# 1.387 18-Jul-2011 deraadt

put aucat with network daemons for now, until a better solution is found


# 1.386 18-Jul-2011 deraadt

move aucat very early, to cope with pkgs; ok aja


# 1.385 11-Jul-2011 deraadt

there is a usage case where ypldap can be used without the local
domainname being set. adjust the scripts to start it in that way.
discussed with pyr


# 1.384 09-Jul-2011 halex

tee the output from rc.firsttime to /dev/tty before passing it to mail(1)
so we can enjoy it on the screen as well

ok deraadt@


# 1.383 08-Jul-2011 deraadt

re-add ospfd/ospf6d support which got lost, and build scripts for them


# 1.382 08-Jul-2011 deraadt

early daemons fit on a line


# 1.381 08-Jul-2011 robert

move the pflog0 setup to the pflogd script and only
do that if pf is actually enabled (rely on pfctl -si)

requested by deraadt@


# 1.380 08-Jul-2011 ajacoutot

Forgot to commit that part yesterday, spotted by sthen@


# 1.379 08-Jul-2011 deraadt

simplify, shorten, and "subtly and cleverly" rearrange some daemon
startups according to rules that some of us understand. it may come of
sounding cocky, but any step beyond that would end up with a dependency
graph which will never happen. this file is now ~60% of the length a
week ago.
ok guenther, robert, aja and people who will not test it until it is in


# 1.378 08-Jul-2011 robert

fix boot output and make sure spamlogd is only started when needed


# 1.377 08-Jul-2011 robert

Switch amd and spamlogd to rc scripts and make sure that the
rc_pre() functions are returning correctly. This change
also simplyfies the changes because false || return 1 can be replaced
with false if that's the last call. thanks halex@!


# 1.376 08-Jul-2011 deraadt

Small bits of fluff before the final re-organization
ok halex


# 1.375 08-Jul-2011 deraadt

ARGH! the third part: socket handling cleanup


# 1.374 08-Jul-2011 deraadt

Oops, the second half of moving the key chunks


# 1.373 08-Jul-2011 deraadt

Move various bits of key generation in rc into one function, which we
can run surprisingly early. Move the X socket directory creation code
into a function too.
robert liked it


# 1.372 08-Jul-2011 ajacoutot

Add the nfs startup scripts.

ok robert@


# 1.371 08-Jul-2011 deraadt

Give up on btd(8) startup until it can prove itself


# 1.370 08-Jul-2011 robert

switch pflogd to rc.d


# 1.369 08-Jul-2011 robert

only start spamlogd if spamd_flags != NO and spamd_black = NO
spotted by halex@


# 1.368 08-Jul-2011 robert

make rc_daemons use start_daemon instead of calling the script directly


# 1.367 07-Jul-2011 deraadt

oops, the netstart for pfsync *MUST* have the conditional


# 1.366 07-Jul-2011 deraadt

disable the afs enable stuff. when nnpfs is re-enabled, that can be added
at the right place.


# 1.365 07-Jul-2011 robert

add scripts for aucat and spamd and switch rc to use them


# 1.364 07-Jul-2011 guenther

Eliminate some $? tests by rolling the command into the condition

ok halex@


# 1.363 07-Jul-2011 deraadt

oops, removed one absolute path which is needed


# 1.362 07-Jul-2011 deraadt

kvm_mkdb and dev_mkdb have been reliable for years, so we can run them
silently now.
ok guenther


# 1.361 07-Jul-2011 deraadt

We don't need a conditional around the pfsync start.

(As a reminder to others who spot this weirdness later and get
confused like I did: netstart never starts pfsync automatically,
because it would screw the states. That is why there is this 2nd
manual netstart run for pfsync)

ok mpf


# 1.360 07-Jul-2011 robert

add a script for btd and replace the rc parts


# 1.359 07-Jul-2011 robert

add wsmoused script and switch xdm and wsmoused in rc


# 1.358 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.357 07-Jul-2011 deraadt

Move various "console-ish" services into a new start_daemon block near
the bottom, after checking that they are OK with being there.
ok ajacoutot


# 1.356 07-Jul-2011 deraadt

Do not use absolute paths for things on our (very simple safe) path.


# 1.355 07-Jul-2011 robert

move portmap, yp* and kerberos services to rc.d scripts


# 1.354 07-Jul-2011 robert

remove superfluous semicolon from start_daemon()


# 1.353 06-Jul-2011 robert

Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.

I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.


# 1.352 22-Apr-2011 ajacoutot

Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc.
By default, rc.{local,shutdown} don't output anything anymore.

original idea from schwarze@
discussed with deraadt@ and no objection from millert@
ok schwarze@ robert@


# 1.351 16-Apr-2011 ajacoutot

Output 'starting standard daemons:' to be consistent with the rest.

ok deraadt@


# 1.350 23-Mar-2011 stevesk

use ssh-keygen -A; ok deraadt


# 1.349 17-Mar-2011 robert

- introduce the INRC environment variable so that rc.subr(8) knows if it
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore

brainkilling work done by me and ajacoutot@, ok ajacoutot@


Revision tags: OPENBSD_4_9_BASE
# 1.348 14-Jan-2011 deraadt

in the most trivial way, request that the kernel arc4random re-key after
we run netstart
ok tedu, djm liked it too


# 1.347 10-Jan-2011 deraadt

talk to /dev/arandom as a single read or write.
in particular a single write will result in a single re-key event,
rather than 64 writes causing 64 re-keys -- wasting the kernel's time.
ok guenther


# 1.346 22-Dec-2010 deraadt

Consistantly use /dev/arandom for feeding entropy to the kernel.
ok kjell otto miod


# 1.345 08-Nov-2010 ajacoutot

Don't print 'Null message body; hope that's ok' in the rc output if the
call to rc.firstime doesn't output anything to mail(1).

ok deraadt@ halex@


# 1.344 02-Nov-2010 deraadt

delete excessive ; use


# 1.343 26-Oct-2010 robert

Add a simple 'rc' system to base in order to start/stop/restart/reload
services installed by the ports system (for now).
It only uses pgrep/pkill to handle these processes. A manual page will
come later.

'put it in' deraadt@


# 1.342 01-Oct-2010 jakob

start nsd(8); ok deraadt


# 1.341 06-Sep-2010 naddy

add ssh_host_ecdsa_key to /etc; from Mattieu Baptiste <mattieu.b@gmail.com>
ok deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.340 27-Jul-2010 martinh

Add ldapd to rc and rc.conf. Enable it at boot with ldapd_flags=.

ok deraadt@ gilles@


# 1.339 13-Jul-2010 sthen

When cleaning /tmp at boot, run the slower find unconditionally.
Previously if the quick rm -rf failed, find was not run, so some files
were not removed. Looks good to tedu@.


# 1.338 28-Jun-2010 reyk

Add iked to rc/rc.conf, you can enable it on boot with the iked_flags= var.
Also copy the generated RSA key for isakmpd into the iked directory; this
way we share the same RSA key by default.

ok deraadt@ jsg@


# 1.337 25-Apr-2010 michele

Add ldpd(8) to /etc/rc* files.
It needs to be started before the routing daemons.
In this way every new prefix learnt by them already has a label associated.

discussed with and ok'ed by claudio@


# 1.336 23-Apr-2010 ratchov

start ``aucat -l'' from /etc/rc, unless aucat_flags=NO, which is
the default setting in rc.conf.

ok deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.335 04-Jan-2010 deraadt

If a /etc/rc.firsttime file exists, run it just once, mailing the output to
root. If anyone wants to use this in a siteXX.tgz file, please be sure to
*concatenate* to the file -- not replace it -- since the installer is going
to be using this file itself.
discussed with todd and halex


# 1.334 04-Dec-2009 deraadt

use mv -f to avoid stopping during wrongly mounted root; sbeyer@reactor.de


# 1.333 23-Nov-2009 deraadt

Move ipsec key creation before isakmpd, and sshd to become the first
of the network daemons so that it can be used if another daemon stops
in its tracks.
ok claudio markus sthen


# 1.332 12-Aug-2009 deraadt

change some defaults inside amd itself, so that the rc scripts no longer
have to pass those options. this makes amd much easier to restart by
hand (though it still remains a nasty daemon do that with)
ok millert


# 1.331 07-Aug-2009 sthen

- specifically match carp+([0-9]):, not just carp*:. avoids spurious
attempts to "ifconfig carp down" noticed by david@.

- use non-descriptive variables names rather than $if/$junk to encourage
people reading the code to think what it's doing; many of the output lines
are not interface names.

ok david@


# 1.330 05-Aug-2009 deraadt

correct indent


# 1.329 04-Aug-2009 sthen

Don't use grep/cut during shutdown, /usr might not be mounted.
Spotted by deraadt@. These were used to bring down carp ifaces
cleanly; replace with shell features.

ok deraadt@, henning@. "Much mo' better" blambert@.


Revision tags: OPENBSD_4_6_BASE
# 1.328 30-Jun-2009 deraadt

extra spaces found during inspection of other goo


# 1.327 30-Jun-2009 robert

Make syslogd create a socket in /var/www/dev when httpd is enabled in order
to make logging to syslog work with php for example.

ok deraadt@, henning@


# 1.326 03-Jun-2009 jj

Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@


# 1.325 31-May-2009 halex

Make sure xdm is installed before trying to run it

ok deraadt@


# 1.324 17-Apr-2009 henning

a scrub was hiding here when nfs was enabled. since we want the no-df
behaviour here replace by an explicit set reassemble yes no-df.
noticed by Valery Masiutsin <val.masutin at gmail dot com>


# 1.323 16-Mar-2009 jacekm

support for smtpd(8); ok gilles@


# 1.322 04-Mar-2009 mcbride

Don't synchronise carp states in default PF ruleset, these get created
on each host and end up conflicting, so they never sync anyways.

ok dlg henning


Revision tags: OPENBSD_4_5_BASE
# 1.321 11-Dec-2008 naddy

Bump size of isakmpd RSA host key up to 2048 bits to match the
SSH2-RSA size; ok hshoexer@, no objection from miod@


# 1.320 27-Nov-2008 uwe

Add bt=YES to /etc/rc.conf.local to start the daemon


# 1.319 03-Oct-2008 deraadt

New option -D to daemonize spamd-setup for early bootup use. This avoids
spamd-setup hanging if there are various (network?) issues and the system
not proceeding to multiuser so that this can be debugged. We do not use
& for startup in /etc/rc because this makes the spamd-setup a child of the
rc scripts after bootup (that is gross)
Problem reported in PR 5864, change discussed with beck, ok millert


Revision tags: OPENBSD_4_4_BASE
# 1.318 09-Jul-2008 djm

automatically populate net.inet.(tcp|udp).baddynamic with the
contents of /etc/services so as to avoid randomly allocating
source ports that correspond to well-known services. Auto-filling
of the baddynamic tables is performed before reading sysctl.conf,
so it is still possible to add or subtract ports, or override the
autofilling entirely there.

Note that this requires a new kernel and /sbin/sysctl.

feedback markus@ ok markus@ deraadt@ millert@


# 1.317 15-Jun-2008 sturm

start rpc.statd together with rpc.lockd

"just get it in" deraadt


# 1.316 09-Jun-2008 mbalmer

Replace nmeattach (which will be removed) with ldattach.


# 1.315 08-Jun-2008 jdixon

Deprecate /etc/dhcpd.interfaces. This is made unnecessary by dhcpd_flags.

ok deraadt@ beck@ reyk@ phessler@


# 1.314 02-Jun-2008 jasper

- add a full stop for consistency

ok deraadt@ dlg@


# 1.313 07-May-2008 claudio

routed is no longer, use ripd instead.


Revision tags: OPENBSD_4_3_BASE
# 1.312 27-Feb-2008 djm

Try to load host.random before starting the network, no network
randomisations (among other things) benefit from it. We still try again
after /var has been definitely mounted in case it is on NFS;
ok deraadt@


# 1.311 31-Jan-2008 reyk

enable snmpd in the build

approved by deraadt@, ok thib@


# 1.310 16-Jan-2008 sthen

create pflog0 whenever pf is enabled, not just when pflogd_flags!=NO
fixes spamlogd with pflogd disabled.

ok henning


# 1.309 09-Jan-2008 mpf

Do not bring up pfsync(4) before the working ruleset
has been loaded. Otherwise, states that are received during the
initial bulk update mismatch the correct pf-checksum and
do not attach to the rules.
Problem identified by david@. Fix done in collaboration.
OK henning@


# 1.308 07-Dec-2007 deraadt

hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status
of pools of hosts; not a status checkers that happens to do some relaying


# 1.307 11-Nov-2007 jmc

-w flag for wsconsctl is deprecated; from Tim van der Molen


# 1.306 15-Oct-2007 deraadt

permit tcp 111/2049 at boot too, for tcp nfs mounts; Jim Rees


# 1.305 08-Oct-2007 norby

Add the user _ospf6d otherwise the newly imported ospf6d daemon will not
start.

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.304 25-Apr-2007 espie

shutdown existing carp interfaces based on ifconfig output, not static
/etc/*.if files.

okay reyk@, deraadt@, krw@...


# 1.303 14-Apr-2007 grunk

introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.

original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@


# 1.302 14-Mar-2007 ckuethe

Allow nmeaattach to start a sensor before starting ntpd. Many modern
receivers can cold start in the time it takes the boot process to get
close to starting ntpd. Even if the gps is not ready or the fix is not
valid, at least the sensor has been created; ntpd won't have to wait
a few minutes before scanning for the sensor. This makes using GPS as
the sole source of time a bit easier.

ok deraadt


Revision tags: OPENBSD_4_1_BASE
# 1.301 27-Feb-2007 beck

catch second instance of spamd_grey - thanks millert and jmc


# 1.300 27-Feb-2007 beck

spamd_grey=YES should really be spamd_black=NO
as disscussed with jmc and millert.
ok millert@


# 1.299 27-Feb-2007 beck

Flag day for spamd -
1) config files move to /etc/mail
2) -g option goes away in spamd-setup and spamd - greylisting is now the default
3) option change to spamd, -b addr becomes -l addr.
4) -b option in spamd-setup and spamd to turn on old blacklisting mode.

Man page shortly to be flensed to make this easier to explain
ok deraadt@ millert@


# 1.298 02-Feb-2007 ajacoutot

- add a new "accounting" variable (default to NO) to enable accouting
(if the file /var/account/acct does not exist it will be created)

ok mk@


# 1.297 31-Jan-2007 pyr

link hoststated to the builds.
ok miod@, henning@


# 1.296 06-Jan-2007 matthieu

remove acpid references. ok gwk@, steven@, grange@ and janus@.


# 1.295 28-Nov-2006 mcbride

Move isakmpd's auto-generated public key, local.pub, into /etc/isakmpd
This makes it readable by unprivileged uses, simplifying configuration,
and there is no reason for it to be secret.

ok msf deraadt hshoexer


# 1.294 16-Nov-2006 henning

when pf and pflogd are enabled, do a "ifconfig pflog0 create" early.
rc checks pflog0 existance before starting pflogd0, pbly to not print an
error message on pflog-less kernels... ugh. ok mcbride


# 1.293 06-Nov-2006 deraadt

duh -- on first boot, do not build the host.random file twice; ok djm


# 1.292 29-Oct-2006 norby

Add the _ripd user and startup stuff.

ok claudio@


# 1.291 27-Sep-2006 mpf

Add ifstated(8) startup bits.
OK deraadt@, henning@, mcbride@


Revision tags: OPENBSD_4_0_BASE
# 1.290 01-Sep-2006 mpf

Switch boot order: isakmpd starts before sasyncd.
If a user is running sasyncd, start isakmpd with -S.
In this mode isakmpd starts off passsive and doesn't
delete SA's on shutdown.
OK ho@, hshoexer@, deraadt@


# 1.289 29-Aug-2006 henning

increase the carp demotion counter by 128 instead of 1 while rc runs.
you do not want a machine that is in the middle of rc and does not have
all network daemons (that possibly increase the carp demotion counter
further) to become master just because the other one lost 2 bgp sessions
or similar for other daemons (esp sasyncd) and as such has a demotion
count of >1.
ok mcbride mpf deraadt


# 1.288 04-Aug-2006 markus

remove redundant comments; noted by mpf; ok deraadt, millert


# 1.287 02-Jun-2006 mcbride

Add sasyncd to rc / rc.conf.

ok deraadt@ cloder@


# 1.286 02-Jun-2006 mcbride

Carp demotion interlock. Prevents carp from preempting until the system is
booted, allowing for daemons to sync with peers before we take over.

ok deraadt@ mpf@ moritz@


# 1.285 01-Jun-2006 norby

Hook dhcrelay(8) into the startup process.

ok henning@


# 1.284 01-Jun-2006 norby

add all the goo to hook dvmrp into the system

ok derradt@


# 1.283 29-May-2006 avsm

revert vfs.nfs.privport sysctl, broke a few architectures
requested by deraadt@


# 1.282 28-May-2006 avsm

Add support for NFS mounts to be from non-reserved ports:

- new sysctl vfs.nfs.privport to require NFS mount requests to be on
reserved ports when set to 1 (the default).
- mountd now automatically sets the sysctl depending on the -n flag.
- add mountd_flags to rc.conf to enable the -n flag at boot.
deraadt@ ok


# 1.281 27-Mar-2006 reyk

add hostapd to rc/rc.conf glue

suggested and ok by kettenis@


# 1.280 22-Mar-2006 hshoexer

As the isakmpd fifo race is fixed, hook ipsecctl to rc.

ok naddy@ todd@


# 1.279 14-Mar-2006 deraadt

move wsconsctl up earlier, so that any key changes made can be used
to (for instance) interrupt dhclient with a ^C instead of a 'CAPS-LOCK C'
from e@molioner.dk checked by matthieu


# 1.278 12-Mar-2006 otto

Use the new -s flag to mount the /usr and /var partitions. Avoids
doubly mounted mfs partitions. Also, at the end of the mount dance,
try mount all partitions, not just nfs partitions. Handles a case
where local paritition mounted inside a nfs partition where not
mounted by rc (/usr on nfs with a local /usr/obj, for example).
ok deraadt@ henning@


Revision tags: OPENBSD_3_9_BASE
# 1.277 12-Jan-2006 deraadt

configure mixers late; obsd@enop.org 4970


# 1.276 30-Nov-2005 tom

Change "starting rpc daemons" to "starting initial daemons" as we
also start ntpd at this time.

discussed with jmc@; ok deraadt@


# 1.275 16-Nov-2005 camield

add new ftp-proxy startup bits

ok henning beck


# 1.274 31-Oct-2005 henning

add bits for watchdogd startup, PR4540 Michael Knudsen <e@molioner.dk>
but I put it at a different place, watchdogd is really not a network daemon


# 1.273 22-Sep-2005 deraadt

split ypserv & ypbind startup; ypserv does not depend on you being a
client; from amh@POBOX.COM


# 1.272 19-Sep-2005 fgsch

change printed line from `printer' to `lpd'; deraadt@ ok.


Revision tags: OPENBSD_3_8_BASE
# 1.271 25-Jul-2005 mcbride

Fix the test for successful ifconfig of carp interface on shutdown, makes
graceful shutdown work correctly.

ok mpf@ deraadt@ a long time ago, committed to local repository by accident.


# 1.270 19-Jun-2005 deraadt

ntpd -s by default is just a pause if there is no net


# 1.269 14-Jun-2005 dhartmei

split the dummy ruleset pfctl -f - -e into separate -f - and -e.
relevant when the dummy ruleset can't be loaded, we still want to enable
pf, otherwise the real ruleset (even if that does load correctly) won't
be active. might happen on a non-GENERIC kernel or after an update (before
/etc is manually updated). reported by Jim Rees. ok frantzen@


# 1.268 02-Jun-2005 tholo

Start on a basic ACPI framework -- does not do much more than read out the
ACPI tables into kernel memory and attach ACPI and HPET timers currently.

In order to test this code, enabling the devices in GENERIC as well as
the ACPI_ENABLE option is needed. This code does not do any thermal
control yet, so this should be done with care depending on the platform.

In the tree so more people can contribute to making this more fully
featured.

Ok niklas@ grange@ tedu@


# 1.267 19-May-2005 millert

o change wsconsctl.conf subshell into a function
o move test for foo.conf into the foo_conf function proper


# 1.266 18-May-2005 millert

Make test(1) usage consistent when testing a variable that may not be set.
OK deraadt@


# 1.265 18-May-2005 millert

o move sysctl and mixerctl parsing into a subroutine instead of a subshell
o update resource limits if kern.maxproc or kern.maxfiles is changed


# 1.264 09-Apr-2005 deraadt

if, at boot time, a /etc/resolv.conf.save is found, assume this is from
a dhclient that crashed so hard it was unable to swap the file back,
and hence, finish that job. i convinced krw and henning that this is
right right place (not in netstart)


# 1.263 01-Apr-2005 deraadt

OK, this is an insane commit. Comes from johnb@ugrad.cs.ualberta.ca, pr 3589.
somehow he got his YP and DNS screwed up and nslookup $h was dealing with h = ""
which was doing nslookup "", which is bad and hangs boots. be more careful
by doing echo $h | nslookup instead.


# 1.262 22-Mar-2005 henning

add ospfd, ok theo
From: Jason Crawford <jasonrcrawford@gmail.com>, whitespace fixes me


Revision tags: OPENBSD_3_7_BASE
# 1.261 19-Jan-2005 millert

Only try to run pflogd if pflog0 exists; from mpech@
OK deraadt@ and fgsch@


# 1.260 22-Nov-2004 jsg

Add support for setting mixerctl values in a sysctl.conf like manner
via mixerctl.conf.
ok deraadt@, earlier version ok henning@


# 1.259 03-Nov-2004 henning

introduce spamlogd_flags to make it easier to e. g. bind spamlogd
to an interface; no change in default config
from Toni Mueller <support@oeko.net>, ja ja ja ja bob


# 1.258 22-Oct-2004 itojun

default pf rule too restrictive for IPv6 (need to allow NS/NA). deraadt ok


# 1.257 19-Oct-2004 grange

Use inet6 pf rules only for inet6-capable setups, first spotted
by form@pdp-11.org.ru.

ok todd@ henning@


# 1.256 27-Sep-2004 henning

kill double whitespace, PR3934, for rea this time and without unrelated
changes


# 1.255 27-Sep-2004 henning

ooopppssss, backout last, lots of unrelated changes creeped in, noticed
by jmc


# 1.254 27-Sep-2004 henning

double whitespace, one from PR3934


# 1.253 18-Sep-2004 henning

unconditionally add -s to ntpd_flags in rc and suggest "" for normal
use in the comment in rc.conf again, idea & ok theo


# 1.252 17-Sep-2004 mcbride

Set up alternate keyboard encoding earlier in rc.

ok miod@ henning@ deraadt@


Revision tags: OPENBSD_3_6_BASE
# 1.251 21-Aug-2004 hshoexer

no need anymore to require isamkpd.policy for isakmpd startup
ok ho@ henning@


# 1.250 07-Aug-2004 deraadt

permit icmp6-type routersol out, and icmp6-type routeradv in, at boot time


# 1.249 06-Jul-2004 henning

eh, actually add the startup code for ntpd


# 1.248 04-Jun-2004 grange

hotplugd startup.

ok deraadt@


# 1.247 16-May-2004 henning

dhclient doesn't write a pid file any more; do remove the code that
deals with it at startup; noticed by wilfried, millert ok


# 1.246 16-May-2004 mcbride

Bring down carp interfaces gracefully even if powerdown=YES in rc.shutdown.

ok krw@ deraadt@


# 1.245 28-Apr-2004 deraadt

spacing


# 1.244 27-Apr-2004 markus

generate a isakmpd (host) key; ok henning, deraadt, cedric


# 1.243 26-Apr-2004 deraadt

double check that the carp* interfaces exist before knocking them down,
mcbride and i think this diff looks good but do not feel like doing the
250 meter walk to go test it


# 1.242 30-Mar-2004 otto

Allow spamd_flags banner to contain spaces. Resolves PR 3720.
ok beck@ millert@


Revision tags: OPENBSD_3_5_BASE
# 1.241 22-Mar-2004 cedric

Fix CARP shutdown. ok deraadt


# 1.240 22-Mar-2004 mcbride

Pass pfsync and carp traffic in the boot-time pf configuration.
Bring carp interfaces down at shutdown, to make a graceful exit if we're master.

ok deraadt@


# 1.239 05-Mar-2004 henning

add the goo for bgpd, theo ok


# 1.238 03-Mar-2004 deraadt

move spamd to a better place; ok henning beck


# 1.237 02-Mar-2004 deraadt

A better place for sshd; pointed out by millert


# 1.236 02-Mar-2004 deraadt

start sshd earlier, ok from various


# 1.235 26-Feb-2004 beck

add support for spamd greylisting with spamd -g and spamlogd to rc/rc.conf


# 1.234 25-Feb-2004 jmc

remove -w option to sysctl;

diffs from Paul de Weerd;
ok deraadt@


# 1.233 11-Feb-2004 beck

simplify afs startup so all you have to do is say "YES" to get basic
AFS functionality (enough to to pkg_add's)


# 1.232 23-Jan-2004 deraadt

permit rpc.yppasswdd run to be blocked, and block by default; ok henning tedu


# 1.231 29-Dec-2003 millert

Move vi.recover invocation until after after ldconf is run. Fixes
a problem when postfix w/ sasl & tls is used instead of sendmail
and perl is dynamically linked anyway. Closes PR 3605.
OK deraadt@ and drahn@


# 1.230 05-Dec-2003 deraadt

spacing


# 1.229 18-Nov-2003 henning

sensorsd startup via rc/rc.conf
ok millert@


Revision tags: OPENBSD_3_4_BASE
# 1.228 29-Jul-2003 henning

"pass on lo0" in the intermediate pf ruleset loaded during boot.
solves PR3376 by matthew.gream@pobox.com, fix slightly different

ok mcbride@ deraadt@


# 1.227 14-May-2003 ian

No more gated. ok krw@, deraadt@, commments from David Krause, jakob@.


# 1.226 08-Apr-2003 millert

fix another non-POSIX chown; Chuck Yerkes


Revision tags: OPENBSD_3_3_BASE
# 1.225 23-Mar-2003 marc

Fix operational typo. Bug reported by William Yodlowsky
bsd at openbsd dot rutgers dot edu. OK millert@, others.


# 1.224 21-Mar-2003 todd

grammar; ok miod@


# 1.223 20-Mar-2003 sturm

enclose X${lpd_flags} in quotation marks, as it could carry more than
one argument.

OK miod@, millert@, henning@, markus@, fries@, tdeval@


# 1.222 10-Mar-2003 deraadt

commented hourly spamd-setup run


# 1.221 04-Mar-2003 jakob

only generate shared secret for rndc if named will be started.
tested by grange@, ok millert@


# 1.220 04-Mar-2003 jakob

remove support for named_chroot and named_user; always run named as user
named and chrooted to /var/named. ok deraadt@


# 1.219 04-Mar-2003 danh

make sure both /etc/rndc.key and /var/named/etc/rndc.key exist, and are
the same.

ok jakob@, deraadt@


# 1.218 14-Feb-2003 cedric

Fix NFS diskless boot when PF is used.
From dhartmei@ e-mail, ok henning@


# 1.217 20-Jan-2003 jakob

generated shared secret for rndc/bind9; ok millert@


# 1.216 20-Jan-2003 millert

Add a /var/empty/dev/log socket for things that chroot to /var/empty.


# 1.215 15-Jan-2003 camield

Allow outbound ping in initial pf rules.

dhclient needs this to validate old (but valid) leases in
/var/db/dhclient.leases in case it needs to fall back to such a
lease. (the dhcp server can be down or not responding)

Reported by Chris Jepeway.

"makes sense" henning dhartmei


# 1.214 06-Jan-2003 marc

Handle wsconsctl.conf entries that contain spaces, e.g.
keyboard.map+="keysym Caps_Lock = Control_L"
OK fgs@


# 1.213 03-Jan-2003 miod

Remove screenblank section; reported by Andrey Matveev.


# 1.212 27-Dec-2002 deraadt

spamd startup stuff


# 1.211 24-Dec-2002 mcbride

Simpler default block.

ok deraadt@


# 1.210 13-Dec-2002 henning

kill whitespace at EOL; David Krause


# 1.209 23-Nov-2002 deraadt

no more altqd use


# 1.208 14-Nov-2002 camield

Allow host to do dns lookups in the initial ruleset. This way, pfctl
can properly boot rulesets with dns addresses in it.


# 1.207 14-Oct-2002 mpech

use stripcom(), not awk. Spotted by form@.

millert@ ok


# 1.206 06-Oct-2002 krw

Remove more remnants of smtpfwdd. ok deraadt@.


Revision tags: OPENBSD_3_2_BASE
# 1.205 12-Sep-2002 millert

We no longer need to install copies of /dev/null and /etc/localtime
in named's chroot jail. These things are now dealt with before
named chroots.


# 1.204 06-Sep-2002 deraadt

more photuris bits by bye bye


# 1.203 20-Aug-2002 hugh

Prevent possible races by moving .X11 fixups to before the system
goes multiuser. In consultation with dynamo; cleared by millert.


# 1.202 27-Jul-2002 matthieu

Create directories for X11 unix socket at boot time. This removes the
need for root privileges for processes that create the sockets later.
ok deraadt@


# 1.201 27-Jul-2002 deraadt

echo before running sshd; mcbride@countersiege.com


# 1.200 11-Jul-2002 deraadt

www space no longer needs a dev/crypto


# 1.199 09-Jul-2002 deraadt

toss a /dev/crypto copy into /var/www/dev; millert ok


# 1.198 11-Jun-2002 dhartmei

pfctl -f instead of -N/-R, ok deraadt@


# 1.197 09-Jun-2002 hin

Remove startup stuff for Kerberos 4 servers.

ok deraadt@


# 1.196 07-Jun-2002 beck

clear /var/authpf on bootup - ensure we don't kill things we shouldn't


# 1.195 23-May-2002 dhartmei

Sigh, add the rule in the right place (not just when NFS is used).
From Dries Schellekens


# 1.194 23-May-2002 dhartmei

Allow incoming ssh connections in the initial temporary rule set that's
active before /etc/pf.conf is loaded, just in case loading fails (and
leaves the inital set active). ok deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.193 25-Feb-2002 deraadt

be silent on kernels which lack nfs; d.doroshenko@omnitel.net


# 1.192 21-Feb-2002 millert

If there is a /var/run/dhclient.pid file, stash its contents and
restore it after cleaning out /var/run. Since we don't have /usr
yet our options are limited here.
Without this change /var/run/dhclient.pid will be removed after
dhclient is started from /etc/netstart.


# 1.191 19-Feb-2002 deraadt

quiet raid check


# 1.190 17-Feb-2002 tdeval

raid(4) parity check simplification


# 1.189 09-Feb-2002 deraadt

move ssh config files to /etc/ssh


# 1.188 08-Jan-2002 tholo

Permit flags to be set for savecore, e.g. to compress core dumps
ok millert@ fgsch@


# 1.187 30-Dec-2001 markus

print "RSA1" for protocol v1


# 1.186 29-Oct-2001 deraadt

handle pflogd_flags better; openbsd@davidkrause.com


Revision tags: OPENBSD_3_0_BASE
# 1.185 09-Oct-2001 angelos

isakmpd can work without an isakmpd.conf, but not without an
isakmpd.policy -- change startup conditions accordingly.


# 1.184 21-Sep-2001 deraadt

start pflogd in a different place; do not block NFS in diskless situations; danh & cedric@wireless-networks.com


# 1.183 19-Sep-2001 todd

re-order shlib_dirs, now X11R6/lib, local/lib, then custom libdirs
concept originally from Joshua Stein <jcs@rt.fm>, thanks!
markus@, espie@ ok; based on useful discussion from fgsch@, espie@, heko@


# 1.182 22-Aug-2001 deraadt

pflogd_flags; mbing@nfr.net


# 1.181 22-Aug-2001 deraadt

oops, forgot to up pflog0; mbing@nfr.net


# 1.180 21-Aug-2001 deraadt

start pflogd at the right place, I think


# 1.179 17-Aug-2001 deraadt

altqd startup stuff


# 1.178 04-Jul-2001 mickey

wsconsctl.conf support, wsconsctl accepts saner var names now; raadtified


# 1.177 03-Jul-2001 deraadt

pull in rc.conf early so that pf(1) startup is right; tested by jasoni, comments from millert


# 1.176 01-Jul-2001 kjell

Initialization infrastruture for pf. Based on initial patches
by ian@, and much input and mangling from theo.


# 1.175 27-Jun-2001 hin

KerberosV support.

Kerberos related cleanup.


# 1.174 22-Jun-2001 deraadt

bail YP if no domainname; dima@unixfreak.org


# 1.173 12-Jun-2001 fgsch

Use lpd_flags instead of lpd, thus allowing to pass parameters to lpd;
patch from Yozo TODA <yozo@imit.chiba-u.ac.jp>, deraadt@ ok.


# 1.172 02-Jun-2001 miod

With recent changes to swapctl(8), replace the invocation of swapon
with two swapctl invocations.
Swap on block devices is enabled before fscking filesystems, swap on
files is enabled after all filesystems (including remote) are mounted.


# 1.171 30-May-2001 deraadt

Remove ipf. Darren Reed has interpreted his (old, new, whichever)
licence in a way that makes ipf not free according to the rules we
established over 5 years ago, at www.openbsd.org/goals.html (and those
same basic rules govern the other *BSD projects too). Specifically,
Darren says that modified versions are not permitted. But software
which OpenBSD uses and redistributes must be free to all (be they
people or companies), for any purpose they wish to use it, including
modification, use, peeing on, or even integration into baby mulching
machines or atomic bombs to be dropped on Australia. Furthermore, we
know of a number of companies using ipf with modification like us, who
are now in the same situation, and we hope that some of them will work
with us to fill this gap that now exists in OpenBSD (temporarily, we
hope).


# 1.170 15-May-2001 deraadt

swapon -a before fsck is run


# 1.169 03-May-2001 deraadt

oops


# 1.168 02-May-2001 deraadt

wsmoused support; missed 2.9 -- bad aaron; heko@saitti.net


Revision tags: OPENBSD_2_9_BASE
# 1.167 19-Apr-2001 deraadt

permit passing sshd flags; djm


# 1.166 01-Apr-2001 deraadt

wscons rc files are not nicely MI clean, so when some nice diffs are shown around, they can go back in


# 1.165 02-Mar-2001 deraadt

amd now crates autodir by itself


# 1.164 23-Feb-2001 deraadt

I tried to figure out how to have tmp_mnt get created automatically
inside amd source code. I could not figure out. So here it goes,
until some rocket scientist points out how to do it in the real source.


# 1.163 22-Feb-2001 deraadt

generate all 3 keys, use -t xxx


# 1.162 10-Feb-2001 mickey

install wscons.conf and rc.wscons on alpha/hppa/i386/powerpc and call it from rc


# 1.161 16-Jan-2001 angelos

Check whether /etc/inetd.conf exists before starting inetd (chuck@snew.com)


# 1.160 30-Dec-2000 angelos

Back-out use of apachectl to start httpd:
1) It's one more dependency in /etc/rc
2) It's one more script that starts from /etc/rc (slowdown)
3) We're only going to be starting httpd in /etc/rc anyway (no other
weird operations), so there's no reason to force a change in rc.conf
4) apachectl(8) doesn't mention "startssl" directive
5) Admins can use apachectl to manage httpd regardless of how the
latter was started

Thanks to fgs@ for yelling about this :-)


# 1.159 30-Dec-2000 angelos

Use apachectl to start httpd, rather than directly call httpd in
/etc/rc (PR 1476)


# 1.158 30-Dec-2000 angelos

Initialize RAID parity as needed (PR 1529)


Revision tags: OPENBSD_2_8_BASE
# 1.157 27-Oct-2000 deraadt

after seeding from the host.random file, immediately reset the seed file, so
that if a shutdown-less reboot occurs, the next re-seed is not a repeat


# 1.156 18-Oct-2000 mickey

grammar in comment


# 1.155 09-Oct-2000 aaron

moused will now co-exist with X


# 1.154 07-Oct-2000 millert

If /etc/mailer.conf specifies a mailer other than sendmail, there
may be no /etc/mail/sendmail.cf so don't include that in the check
for whether or not to run /usr/sbin/sendmail. Instead, check for
the existence of /etc/mailer.conf. Pointed out by Theo.


# 1.153 06-Sep-2000 millert

When starting up sendmail in the background, redirect stderr to
/dev/null too. Otherwise, if there is a name resolution problem
the rc files may finish before sendmail forks into a daemon and it
will complain about EBADF on stderr (since init revoked it).
From a discussion between Theo and myself.


# 1.152 01-Sep-2000 aaron

Initialization script stuff for moused.


# 1.151 28-Aug-2000 brad

explicit path to gated so that it will load as expected


# 1.150 25-Aug-2000 deraadt

ssh always installed, no more static lib case


# 1.149 05-Aug-2000 deraadt

host.random whacking must be after /var is mounted, obviously


# 1.148 13-Jul-2000 millert

timed & rdate start before securelevel is set so no need to check
$securelevel; noted by ho@


# 1.147 13-Jul-2000 itojun

rtadvd.conf is not required, actually


# 1.146 11-Jul-2000 matt

- Move ntpd out of rc.securelevel
- Add ntpdate and rdate rc knobs

Approved-And-Assisted-By: millert


# 1.145 06-Jul-2000 itojun

remove ip6defaultif, this is just for IPv6 specification pedants


# 1.144 05-Jul-2000 millert

Start sendmail in the background so it doesn't cause blockage
on reboot timing out on DNS problems.


# 1.143 02-Jul-2000 espie

Clean-up after httpd


# 1.142 18-Jun-2000 todd

ifaliases goes away.
- new installs wont have existing ifaliases
- updates dont touch /etc
- manual updates of /etc/ should know what they're doing anyway

fwiw, see hostname.if(5) alias functionality has moved here for better
overall network configurability


# 1.141 14-Jun-2000 deraadt

avoid a few extra processes; d.doroshenko@omnitel.net


# 1.140 13-Jun-2000 deraadt

normalize test vs [; form


# 1.139 19-May-2000 mickey

nfsiod/nfs_client, bye bye
add commented out entry into sysctl.conf for vfs.nfs.iothreads


# 1.138 15-May-2000 hin

Fix SBINDIR path the right way


Revision tags: OPENBSD_2_7_BASE
# 1.137 12-May-2000 deraadt

work around kerberos SBINDIR being misdefined; hin


# 1.136 03-May-2000 deraadt

hmm... simplify this


# 1.135 30-Apr-2000 ericj

fix PR #1169; itojun@ OK


# 1.134 27-Apr-2000 deraadt

ssh_host_dsa_key not ssh_dsa_host_key


# 1.133 26-Apr-2000 deraadt

build DSA keys automatically at boot time


# 1.132 06-Apr-2000 millert

Enable sendmail 8.10.0. Things like sendmail.* and aliases now live
in /etc/mail.


# 1.131 05-Mar-2000 millert

Adda a stripcom function to strip comments (and leading whitespace,
depending on IFS). This replaces the ed and sed code previously
used to do this.


# 1.130 28-Feb-2000 itojun

add ip6defaultif, which configures default outgoing interface
when no neighboring router is found (rare case). this is to conform
strictly to the ND spec. it is safe to leave it empty.


# 1.129 30-Jan-2000 millert

Use ed, not sed, for pulling the interesting bits out of /etc/sysctl.conf.


# 1.128 30-Jan-2000 mickey

let sed do all the work, do not invoke extra grep; millert@ ok


# 1.127 02-Jan-2000 itojun

add following IPv6 configs: rtadvd_flags route6d_flags rtsold_flags


# 1.126 01-Jan-2000 deraadt

process sysctl.conf way earlier


# 1.125 23-Nov-1999 deraadt

isakmpd is elsewhere; evanc@concer.to


# 1.124 11-Nov-1999 fgsch

Allow identd to be used w/o inetd.


Revision tags: OPENBSD_2_6_BASE
# 1.123 18-Oct-1999 deraadt

ssh startup fix; millert


# 1.122 15-Oct-1999 deraadt

oops, got shared library part wrong


# 1.121 11-Oct-1999 millert

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.


# 1.120 07-Oct-1999 deraadt

check for executability of ssh-keygen


# 1.119 07-Oct-1999 deraadt

if sshd startup fails due to rsa not being there, start up
/usr/local/sbin/sshd instead, if it is there.


# 1.118 06-Oct-1999 millert

Don't complain that /var/tmp/vi.recover is not owned by root
when it doesn't exist.


# 1.117 03-Oct-1999 deraadt

silence the chmod


# 1.116 30-Sep-1999 deraadt

last i checked, screenblank was not a network daemon


# 1.115 29-Sep-1999 deraadt

do ldconfig before all ssh; because they need /usr/local/lib for searching


# 1.114 28-Sep-1999 deraadt

start ssh as part of base system; if no host key, build it upon boot


# 1.113 27-Sep-1999 deraadt

oops


# 1.112 27-Sep-1999 deraadt

stir arandom, too; provos


# 1.111 04-Sep-1999 millert

Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the
check for meta character expansion to be inside the two for loops.
They are expanded by simple assignment.


# 1.110 04-Sep-1999 millert

Ignore /var/tmp/vi.recover if it is a symlink or owned by non-root.
Probably just paranoia (since /var/tmp/vi.recover is created the
first time the machine is booted) but it can't hurt.


# 1.109 04-Sep-1999 millert

Check to make sure vi recovery files are normal files before trying
to read from them (this is a user-writable directory so it is
possible to play games). Fixes a possible DOS noted by dynamo@ime.net.
If it's not a regular file, we delete it.


# 1.108 03-Sep-1999 deraadt

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable


# 1.107 31-Aug-1999 deraadt

start amd in /etc/amd; so that if ${amd_master} contains map names, and we
don't want them fetched from YP, it will find them in the current directory.


# 1.106 19-Aug-1999 kstailey

s/nvi/vi/


# 1.105 05-Aug-1999 millert

typo; -eq not -ne


# 1.104 05-Aug-1999 millert

Use 10 X's for sheeer, raving, paranoia


# 1.103 05-Aug-1999 millert

Use -execdir not -exec in find; deraadt@


# 1.102 04-Aug-1999 millert

Use mktemp(1) for motd /tmp file during boot. This fixes a potential
problem noted by hugh@openbsd.org whereby a user could create the
well-known /tmp/_motd file and use chflags to make it unremovable.
Then at the next reboot the user's /tmp/_motd would end up in the
system motd.


# 1.101 03-Aug-1999 deraadt

chmod/chown all the ptys


# 1.100 15-Jul-1999 provos

move /etc/host.random to /var/db for readonly /, save the entropy state
into /var/db/host.random at shutdown time, so we can make use of it
during reboot to seed our random pool. ok millert@ angelos@ niklas@


# 1.99 30-May-1999 millert

Fix typo, '=' not '=='; marc@snafu.org


# 1.98 26-May-1999 jakob

Configure raid devices at boot (from NetBSD, ok by niklas@).


# 1.97 24-May-1999 millert

Add shlib_dirs variable so users can add to the directories cached
in /var/run/ld.so.hints


# 1.96 21-Apr-1999 alex

Save a copy of the boot messages in /var/run/dmesg.boot.


Revision tags: OPENBSD_2_5_BASE
# 1.95 28-Dec-1998 deraadt

split database line up nicely; krw@tcn.net


# 1.94 21-Dec-1998 deraadt

isakmpd startup stuff


# 1.93 11-Nov-1998 downsj

Add option for running ftpd out of rc.


# 1.92 03-Nov-1998 downsj

Actually use $xdm_flags.


# 1.91 28-Oct-1998 art

use xfs, not afs when mounting afs. Making mount_afs work correctly is too hard.


Revision tags: OPENBSD_2_4_BASE
# 1.90 12-Oct-1998 art

startup code for AFS


# 1.89 19-Sep-1998 todd

shift ifaliases. one more daemon can bind to specific ifaliases.


# 1.88 28-Aug-1998 millert

When running kvm_mkdb, don't specify /bsd so we can use /dev/ksyms if it exists and is configured


# 1.87 25-Aug-1998 marc

put back recent change (apmd flags) that was accidently removed


# 1.86 19-Aug-1998 form

dhcpd: start from rc, controlled by rc.conf; sample config files


# 1.85 18-Aug-1998 marc

allow flags to be passed to apmd at millert's request


# 1.84 18-Aug-1998 marc

start apmd in rc, controlled by rc.conf


# 1.83 24-Jul-1998 millert

update /var/named/etc/localtime when /etc/localtime changes


# 1.82 13-Jul-1998 deraadt

quiet that dd


# 1.81 13-Jul-1998 millert

Create /var/named/dev/null if it is not there and we are running named chroot'd. It would be cleaner to simply do this at install time but this way people who are tracking sources get the correct behavior too.


# 1.80 11-Jul-1998 deraadt

change last route to route -n


# 1.79 05-Jul-1998 todd

yet another typo


# 1.78 04-Jul-1998 todd

fix a typo


# 1.77 03-Jul-1998 angelos

Generate an /etc/host.random if it doesn't exist; 64KB, perms 600.


# 1.76 13-Jun-1998 millert

don't make /var/named/dev/log if named_flags == NO


# 1.75 03-Jun-1998 millert

to turn of named chroot set to be empty, not 'NO'


# 1.74 03-Jun-1998 millert

Add named_user and named_chroot variables to simplify chroot'd named
setup.


# 1.73 14-May-1998 millert

move cron to the end so users cannot run cron jobs before the system is all the way up


# 1.72 13-May-1998 deraadt

test -> [


Revision tags: OPENBSD_2_3_BASE
# 1.71 07-Apr-1998 deraadt

add xdm control to /etc/rc.conf; X11 docs need updating


# 1.70 25-Mar-1998 deraadt

savecore prints a message; no need to print another


# 1.69 25-Mar-1998 deraadt

httpd is now in the tree, and an rc.conf flag turns it on


# 1.68 11-Mar-1998 millert

Kill whitespace at eol.


# 1.67 26-Feb-1998 millert

Replace "test -r" with -s and -e as -r always returns true for root?!?!


# 1.66 18-Feb-1998 art

add an option for kerberos slave servers.


# 1.65 13-Feb-1998 marc

fix typo


# 1.64 11-Feb-1998 deraadt

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.


# 1.63 07-Feb-1998 beck

Flags and startup for smtpd/smtpfwdd - not enabled by default.


# 1.62 06-Feb-1998 deraadt

typo


# 1.61 05-Feb-1998 deraadt

introduce /etc/sysctl.conf containing sysctl variables to change at boot time


# 1.60 23-Jan-1998 art

correct path to the kerberos servers.


# 1.59 21-Jan-1998 downsj

Add ${nfsiod_flags}


# 1.58 21-Dec-1997 deraadt

sigh; move syslog up nearer the top. Any failures from this?


# 1.57 12-Dec-1997 niklas

Diskless root mounts were ro too long


# 1.56 23-Nov-1997 maja

Add support for mopd. -moj


# 1.55 19-Nov-1997 deraadt

clean /var earlier


# 1.54 08-Nov-1997 deraadt

start named earlier; this is an experiment


# 1.53 04-Nov-1997 deraadt

kill spaces at ends of lines; m4


# 1.52 04-Nov-1997 deraadt

things come from rc.conf not netstart nowadays


Revision tags: OPENBSD_2_2_BASE
# 1.51 15-Oct-1997 millert

Add rest of stuff from nvi's recover script.


# 1.50 30-Sep-1997 millert

Make /var/tmp/vi.recover if it does not exist.


# 1.49 26-Sep-1997 millert

Clear /tmp before running /etc/rc.securelevel. Brian Candler <btc@demon.net>


# 1.48 20-Sep-1997 deraadt

re-attempt nfs mounts after named is started...


# 1.47 17-Sep-1997 deraadt

little missing space, argh


# 1.46 14-Sep-1997 deraadt

only start mountd if a non-commented line is in exports; decreased vulnerabilty in common cases


# 1.45 02-Sep-1997 kstailey

The /etc/photurisd directory is created by /usr/src/Makefile's "beforeinstall"
target. It does not represent a desire to run photurisd. Changed photurisd
startup to look for /etc/photurisd/photurisd.conf file.


# 1.44 25-Aug-1997 millert

Explicately pass -host flag to route(8) to avoid confusion with networks.


# 1.43 23-Aug-1997 mickey

echo on ipmon startup


# 1.42 19-Aug-1997 niklas

Add hook for rpc.lockd, make nfsd flags settable in netstart


# 1.41 31-Jul-1997 downsj

Make quotas optional; wedged into netstart for the time being.
/etc/rc.conf, anyone?


# 1.40 25-Jul-1997 provos

earlier start of keymanagement


# 1.39 22-Jul-1997 kstailey

now that ipmon daemon(3)s, remove ampersand


# 1.38 22-Jul-1997 provos

start the photuris daemon per default. hilfe.


# 1.37 20-Jun-1997 deraadt

if screenblank exists, start it


# 1.36 17-Jun-1997 niklas

Put in hooks to start ypserv with flags


# 1.35 17-Jun-1997 niklas

Put in hooks to start rpc.yppasswdd with flags


Revision tags: OPENBSD_2_1_BASE
# 1.34 22-Apr-1997 deraadt

move motd generation to avoid user races; kashmir@umiacs.umd.edu


# 1.33 16-Apr-1997 millert

Don't source /etc/rc.securelevel if it doesn't exist and be
more verbose when upping the securelevel.


# 1.32 15-Apr-1997 deraadt

split rc.local, creating rc.securelevel. Read the comments. If you believe
in securelevels, follow them religiously. Problem found by millert...


# 1.31 28-Feb-1997 millert

fsck now raises datasize limit itself.


# 1.30 19-Feb-1997 tholo

Start kadmind if kerberos server


# 1.29 03-Feb-1997 deraadt

do ifaliases after /usr/bin exists in nfs diskless env; pr#77, matthieu@laas.fr


# 1.28 22-Dec-1996 deraadt

crank ulimit -d for fsck run (someone with a 19GB ccd ran into a problem)


# 1.27 07-Dec-1996 deraadt

ypserv w/o -d is OK


# 1.26 09-Oct-1996 deraadt

bit more careful ldconfig


Revision tags: OPENBSD_2_0_BASE
# 1.25 23-Sep-1996 deraadt

branches: 1.25.2;
rfc1323 variable


# 1.24 07-Sep-1996 millert

typo + comment


# 1.23 04-Sep-1996 deraadt

control portmap, inetd, and lpd from netstart; idea from tqbf@enteract.com


# 1.22 27-Jul-1996 deraadt

syslogd: -s goes away, becomes default. -u becomes insecure mode


# 1.21 25-Jul-1996 deraadt

ypserv, ypbind, then rpc.yppasswdd


# 1.20 18-Jul-1996 downsj

daily: disable the fscks by default.
rc: add /usr/local/lib to ldconfig.


# 1.19 05-Jul-1996 deraadt

start ypbind after ypserv


# 1.18 28-Jun-1996 deraadt

syslogd -s by default


# 1.17 18-Jun-1996 deraadt

move std stuff from rc.local to rc


# 1.16 12-Jun-1996 deraadt

no ypxfrd


# 1.15 12-Jun-1996 deraadt

fix test for yp in resolv.conf


# 1.14 11-Jun-1996 tholo

Kernel-implementation of update(8) my me


# 1.13 10-Jun-1996 deraadt

fix rpc.yppasswdd conditional


# 1.12 30-May-1996 deraadt

use kbd command on /etc/kbdtype if applicable


# 1.11 26-May-1996 deraadt

sync & label


# 1.10 03-May-1996 deraadt

pretty comments, run ypxfrd with ypserv


# 1.9 29-Apr-1996 deraadt

yp depends on /var/yp/bindings, not only /var/yp


# 1.8 29-Apr-1996 deraadt

intuit whether ypbind, ypserv, and rpc.yppasswdd should run


# 1.7 24-Apr-1996 deraadt

start ypserv & rpc.yppasswdd automatically


# 1.6 23-Apr-1996 deraadt

sync with netbsd 960418


# 1.5 09-Jan-1996 dm

added IP filter to netstat/rc and put examples in /usr/share/ipf


# 1.4 30-Dec-1995 deraadt

from netbsd: start mrouted like routed


# 1.3 16-Dec-1995 deraadt

document where syslogd -s would be used


# 1.2 22-Nov-1995 deraadt

kernel is called /bsd


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision