The /etc Files

Now we will take a look at each of the /etc files, going in alphabetical order. We’ll start with /etc/adduser.conf and end with /etc/ypldap.conf.

/etc/adduser.conf

The /etc/adduser.conf file contains the persistent configuration for adduser(8), which Chapter 6 covers in detail. To change adduser’s settings, edit this file. This file is self-documenting, and if you’ve read Chapter 6, you shouldn’t have any trouble with it.

/etc/amd

The automounter daemon automatically loads NFS filesystems upon request. If you’re interested in this function, read the amd(8) man page.

The automounter daemon isn’t as useful as you might think. As the documentation says, “A weird imagination is most useful to gain full advantage of all the features.”

/etc/authpf

The /etc/authpf directory contains the authenticating packet filter configuration. If you’re interested in having user authentication for firewall access, I recommend The Book of PF, 2nd Edition, by Peter Hansteen (No Starch Press, 2010).

/etc/bgpd.conf

OpenBSD includes a BGP daemon, bgpd(8). Most sysadmins will never go near BGP, but if you need it, see the bgpd.conf(5) man page.

/etc/boot.conf

The /etc/boot.conf file controls the system’s booting process, as discussed in Chapter 5.

/etc/changelist

/etc/changelist is a text file that contains the list of files to be checked by the daily security check script, /etc/security. We cover these tasks in detail in Chapter 15.

/etc/chio.conf

The chio(1) medium changer lets you manage jukebox-style media arrays, such as CD and tape changers. If you have a tape backup unit that can swap between multiple tapes all on its own, chio is your friend. Configure chio in /etc/chio.conf. Most OpenBSD users don’t have media changers, but if you’re interested, see the man page for chio(1).

/etc/csh.*

The /etc/csh.* files contain system-wide defaults for csh(1) and tcsh(1). When a user logs in with either of these shells, the shell executes any commands listed in /etc/csh.login. Similarly, when the user logs out, the shell executes any commands in /etc/csh.logout. Put general shell configuration in /etc/csh.cshrc.

/etc/daily and /etc/daily.local

The /etc/daily.local script is run every day to maintain the system. See Chapter 15 for details.

/etc/dhclient.conf

You can configure OpenBSD’s DHCP client by using dhclient(8), as discussed in Chapter 12.

/etc/dhcpd.conf

OpenBSD includes a secure DHCP server. It started life as an Internet Systems Consortium (ISC) DHCP server, but has been repeatedly rewritten and simplified by the OpenBSD team. See Chapter 16 for details.

/etc/disklabels/

The /etc/disklabels/ directory traditionally contains backup copies of disklabels, as discussed in Chapter 8. Very few system administrators actually use it, because very few system administrators know it’s there. OpenBSD copies the disklabels for all system disks as part of the daily backup of critical files (see Chapter 15).

/etc/disktab

A couple of decades ago, hard drives were expensive and precious devices that came in only a few varieties. While modern disks can tell the computer about their geometry, older disks need manual configuration, as do older removable media such as 1.44MB floppy disks and Zip disks. If you want to access one of these ancient disks, you’ll need the information in /etc/disktab. (But if you need to use one of these old disks, you’re almost certainly solving the wrong problem.)

/etc/dumpdates

The /etc/dumpdates file records the dates of the last successful dump(8) backup. The dump tool backs up a filesystem, rather than just the files on a filesystem, as tar(1) does. A dump includes file flags and other special characteristics of the filesystem.

/etc/dvmrpd.conf

OpenBSD implements the Distance Vector Multicast Routing Protocol (DVMRP) with dvmrpd(8), configured in dvmrpd.conf. This is another edge case where OpenBSD performs well, but is of interest only to a few users. If you’re interested in DVMRP, see the dvmrpd(8) man pages.

/etc/exports

NFS servers list the filesystems they export, and who may access them, in /etc/exports. See Chapter 9 for information about using NFS as both a client and a server.

/etc/fbtab

OpenBSD can change the ownership of system files and devices based on how a user has logged in. When a user logs in via the text console, login(1) changes the ownership of the console, as well as the keyboard and the mouse, to that user. This way, users can then configure the keyboard or mouse to suit their preferences. A user who logs in via an X session needs similar changes.

You could use /etc/fbtab to change permissions on other devices or files for other special needs, but this is really tricky to get right, and usually means you’re making something much more complicated than it needs to be. If you’re considering this approach, rethink your problem.

/etc/firmware

Some hardware needs software to run. In years past, this software would have been loaded onto programmable read-only memory (PROM) chips on the device itself. Network cards often had boot PROMs that let them get configuration information from the network. PROMs are not expensive these days, but making millions of anything adds up quickly. Hardware vendors now often ask the operating system to load this software, called firmware, onto the hardware for them.

Firmware is usually a closed-source binary object, or blob. While the OpenBSD team members would never accept loading a blob into the kernel, they’re willing to hand a file to a piece of hardware. It doesn’t matter if the hardware gets the blob from the operating system or from a PROM chip attached to the hardware—it’s still software that runs only on the device, not in the operating system.

For user convenience, OpenBSD distributes firmware that it’s legally permitted to offer. If OpenBSD cannot distribute firmware on the installation media, the fw_update script uses the package system to fetch it over the Internet. Wherever the firmware comes from, it’s stored in /etc/firmware.

By default, fw_update runs at first boot after an OpenBSD install or upgrade, but you can run it any time you want (it’s stored in /usr/sbin).

/etc/fonts/

The /etc/fonts/ directory contains the Xenocara X11 fonts. We’ll discuss Xenocara and X11 in Chapter 17.

/etc/fstab

The filesystem table lists all filesystems that the system knows about, whether they’re automatically mounted at boot or kept in reserve. See Chapter 8 for details.

/etc/ftpchroot

Users listed in /etc/ftpchroot are automatically chrooted into their home directory when they log in via FTP. See ftpd(8) for full details.

Try to avoid FTP, as it transmits usernames and passwords in cleartext. Use scp(1) or sftp(1) instead.

/etc/ftpusers

The /etc/ftpusers file does exactly the opposite of what the filename implies, but it has been this way for decades, so don’t worry about it.

Any user listed in /etc/ftpusers cannot log in via FTP. See ftpd(8) for details, but again, use scp(1) or sftp(1) instead—especially for administrative tasks!

/etc/gettytab

The /etc/gettytab file contains the configuration information for login terminals. Unix-like systems have been traditionally accessed by anything and everything, from innumerable slightly different serial consoles to Secure Shell (SSH) sessions over the network. If you ever need to use a nonstandard terminal type, explore /etc/gettytab.

There’s no reason to get rid of this file. After all, someone out there probably still uses a plugboard 1200-baud terminal. But there’s no longer any reason to modify it either. In any case, the man page is worth reading, especially if you read it to the end.

/etc/group

The /etc/group file controls to which groups each user account belongs. User groups are covered in Chapter 6 and Chapter 7.

/etc/hostapd.conf

OpenBSD can act as a wireless access point. The host access point daemon (hostapd(8)) lets OpenBSD perform some complicated access point tasks that are useful in larger environments. OpenBSD’s wireless services are interesting if you use wireless; read hostapd(8) and ifconfig(8) for full details.

/etc/hostname.*

The /etc/hostname.* files configure network interfaces, as discussed briefly in Chapter 4 and at length in Chapter 12.

/etc/hosts

The /etc/hosts file contains a hand-maintained map of IP addresses and hostnames. See Chapter 12 for details.

/etc/hosts.equiv

The /etc/hosts.equiv file is used by the various r-tools, such as rcp(1), rlogin(1), and rsh(1). These tools, and the underlying protocols, are relics of an earlier age, when security on the Internet was not so great a concern. OpenBSD no longer includes an rlogin(1) client. The r-tools are largely replaced by SSH. Today, you should not use the r-protocols under any sensible circumstances.

The /etc/hosts.equiv file should not contain any uncommented entries, unless you specifically put them there. This is the only system file I can reasonably say every sysadmin should verify is empty and marked immutable (see Chapter 10).

What did I mean by “sensible circumstances” and using the r-protocols? A few years ago, I worked on a network with ancient but mission-critical VMS servers manageable only by r-protocols, but those were not reasonable circumstances. If you find yourself similarly trapped, check out hosts.equiv(5), rshd(8), and rsh(1). And do something about your circumstances.

/etc/hosts.lpd

You can configure an OpenBSD system to accept print requests from other machines and feed them to a locally attached printer. This was vital when printers were big, expensive beasts, but it’s less important today. This file lists the hostnames or IP addresses of systems that may use the local system’s line printer daemon, lpd(8).

If you’re really interested in having your OpenBSD system print, check out lpd(8) and /etc/printcap.

/etc/hotplug/

OpenBSD can automatically take action when a device is plugged into the system through hotplugd(8). For example, if you attach your digital camera to a USB port, hotplugd can run a script that will attach the device node to a directory and make it readable by your user account.

hotplugd runs the script /etc/hotplug/attach when a device is attached, and /etc/hotplug/detach when a device is removed. These scripts must be carefully written to match the devices being attached and detached. For details on how this works, see hotplugd(8).

/etc/ifstated.conf

The interface state daemon ifstated(8) monitors network conditions and takes action when specified events occur. For example, you can configure ifstated to watch for another server to go down, and when that server fails, start up the local web server. For more information about using ifstated, see Hansteen’s The Book of PF.

/etc/iked/, /etc/iked.conf, /etc/ipsec.conf, and /etc/isakmpd

The /etc/iked/, /etc/iked.conf, /etc/ipsec.conf, and /etc/isakmpd files manage OpenBSD’s implementation of the IPsec standard for VPNs. OpenBSD has a very robust IPsec implementation, and it is actually used for testing by various interoperability groups.

You can fill entire books with the acronyms used for VPN technologies, let alone instructions for actually configuring them. See the man pages for details.

/etc/inetd.conf

The Internet small service listener inetd(8) attaches to multiple network ports for programs that don’t need to run constantly. When a request on one of those ports comes in, inetd activates the correct program to handle the request. Chapter 16 discusses inetd(8) in more detail.

/etc/kbdtype

The /etc/kbdtype file contains a single line with your preferred terminal keyboard mapping. Test your keyboard mapping with kdb(1), and then put that keyboard mapping in /etc/kbdtype.

/etc/kerberosV/

The /etc/kerberosV/ directory contains configuration for the Kerberos centralized authentication system. I recommend some kind of centralized logon for every network. Configuring Kerberos properly is a large subject. If you’re interested, peruse kerberos(1).

/etc/ksh.kshrc

/etc/ksh.kshrc is the global configuration file for the public domain Korn shell included with OpenBSD. Users must include this file in their personal .kshrc for settings here to take effect. See the ksh(1) man page for details.

/etc/ldap/ and /etc/ldapd.conf

OpenBSD includes a Lightweight Directory Access Protocol (LDAP) daemon. LDAP is commonly used for centralized authentication, address books, and other database operations that are read more than they write. As of this writing, the features of ldapd(8) are not complete, but it’s good enough to provide a central authentication point.

/etc/localtime

The /etc/localtime file is a symlink to the actual time zone file. To change the time zone, change the symlink. Chapter 4 covers time zones.

/etc/locate.rc

The /etc/locate.rc file controls creation of the locate(1) database. OpenBSD updates the locate database every week, as discussed in Chapter 15.

/etc/login.conf

With /etc/login.conf, you can control user account login behavior, as discussed in Chapter 6.

/etc/lynx.cfg

OpenBSD includes the lynx(1) text-mode web browser. Lynx is endlessly configurable, and settings in /etc/lynx.cfg affect all Lynx users on the system. You can save yourself a lot of trouble by configuring your proxy server settings here.

/etc/magic

Many files include a “magic number” and other characteristics specific to their type. file(1) uses these magic numbers to identify the file type, with /etc/magic as an index of magic numbers. Do not manually edit /etc/magic, as it’s automatically generated by compiling file(1).

/etc/mail/

The /etc/mail/ directory contains the configuration files for OpenBSD’s email software. OpenBSD includes two email packages: the old workhorse Sendmail and the OpenBSD-created smptd(8). smptd isn’t quite ready for production use, but it might be by the time this book hits the shelves.

This directory also contains /etc/mail/aliases, a list of mail redirections. Be sure you set the email alias for your root account to somewhere you’ll actually read your email, as discussed in Chapter 4.

/etc/mail.rc

The /etc/mail.rc file has nothing to do with sending or receiving email as a mail server. It’s the global configuration file for the mail(1) email client. While more advanced email clients have almost completely superseded mail, it’s worth exploring because almost any Unix-like system will have it installed.

/etc/mailer.conf

Traditionally, the only mail server program available for any Unix-like operating system was Sendmail. As such, a huge amount of add-on software expects to find /usr/sbin/sendmail and expects it to behave in a certain manner. It doesn’t matter that, by modern standards, Sendmail and the whole Simple Mail Transfer Protocol (SMTP) are baroque and bizarre; software expects to find it.

Worse, sendmail(8) behaved differently depending on what name it was called with. Programs such as send-mail, mailq, and newaliases are all Sendmail wearing different hats. If you call the Sendmail program by running the mailq command, it runs differently than if you call it by running the newaliases command. They all point to the same binary on disk, however. Third-party software expects to find all these names as well, and that these commands behave as required.

Sendmail is such a standard that writers of newer mail server programs are forced to call them sendmail and to have them behave exactly as Sendmail does, just to maintain compatibility with this vast installed base. This makes using alternate mailers confusing. Also, OpenBSD includes Sendmail as part of the base system. You can’t just remove Sendmail and go on. Upgrades reinstall brand-name Sendmail.

OpenBSD does an end run around all this confusion by eliminating /usr/sbin/sendmail as an actual mail program. Instead, the sendmail program is just a wrapper that calls the real mail-handling software. The entries in /etc/mailer.conf are just a list of classic Sendmail program names, along with the path to the actual program to be run. The mail-handling program sendmail is actually installed as /usr/libexec/sendmail/sendmail, for example.

To run an alternate mail server, give /etc/mailer.conf the expected command name and the full path to all of the appropriate programs. This happens automatically when you install a new mail transfer agent from a package.

/etc/man.conf

The etc/man.conf file tells man(1) how to find and present man pages. If you install software in nonstandard locations, add the information on the software’s man pages to man.conf so that you can call up those man pages transparently. This file has several types of entries, each of which is set off by keywords or section names.

Why would you do this? If you must install software from a source other than ports or packages, you could place it in a directory tree outside those managed by OpenBSD to reduce confusion when upgrading or adding software.

For example, I occasionally install Wireshark on an OpenBSD desktop. The OpenBSD team decided to remove OpenBSD’s Wireshark package because it has such a shaky security history. If I installed Wireshark as /usr/local/bin, it would be mingled with my packaged software. If I install Wireshark as /usr/local/wireshark/bin, however, it’s clearly distinct from packaged software. I can’t access the man pages, however, as man(1) doesn’t know about /usr/local/wireshark/man.[39] Let’s walk through how we would add man page access for Wireshark.

Adding to the Search Index

The _whatdb keyword gives the full path to a whatis(1) database, used by apropos(1) and whatis(1), allowing you to easily search and cross-index man pages. The file man.conf has entries for databases in /usr/local/man, /usr/share/man, and /usr/X11R6/man. Here’s how to add an entry for /usr/local/wireshark/man:

_whatdb /usr/local/wireshark/man/whatis.db

Now we create a new database with makewhatis(8). This job runs automatically when you install software and during weekly maintenance.

Adding to Man Page Directories

Man pages are scattered in directories all over the system. The _default keyword tells man(1) which directories to search automatically. Use only one _default keyword, but list multiple directories if needed, and group directories using brackets.

Here’s the standard directory list:

_default /usr/{share, X11R6,local,ports/infrastructure}/man/

This is a pretty massive group of directories, and the brackets combine multiple directories associatively. For example, this entry means that we check /usr/share/man/, /usr/X11R6/man/, /usr/local/man/, and /usr/local/ports/infrastructure/man/. (The entries end with a slash, which means that the final directories contain subdirectories.)

To add /usr/local/wireshark/man/ to the default locations, add local/wireshark into the associative array, like this:

_default /usr/{share, X11R6,local,ports/infrastructure,local/wireshark}/man/

The _subdir keyword lists subdirectories to be searched beneath the main directories, in order, with the first match returned first.

_subdir  man1 man8 man6 man2 man3 man5 man7 man4 man9 man3p man3f mann

You can use _subdir to change the order in which man pages are returned. For example, if your job is programming Perl on OpenBSD, you might want to see the Perl man pages by default. In that case, you could move the man3p subdirectory to the front of the list.

Displaying Man Pages

Software vendors distribute their manuals in the format they think best. As a sysadmin, this means you might as well get manuals in random formats, because each format needs a different command to display it. Fortunately, each format has a different filename suffix, which tells man(1) how to display the file. The _build keyword defines a filename suffix and the command used to display the file. (It’s very unlikely that you’ll have a man page that requires a new _build statement.)

Defining Man Sections

The final man.conf function is dividing the manual into sections. We saw in Chapter 1 that you can search the manual by particular sections to get specific man pages. These sections are nothing more than directories identified in /etc/man.conf. Here’s where we define the man pages included in section 1.

1 /usr/{share,X11R6,local}/man/man1

There’s no trailing slash, because we’re not adding any subdirectories. These are the actual directories containing section 1 of the manual.

You can define arbitrary section names in /etc/man.conf. While you should avoid section names beginning with an underscore in order to prevent confusion with keywords, you can do just about anything else.

/etc/master.passwd, /etc/passwd, /etc/spwd.db, and /etc/pwd.db

The /etc/master.passwd, /etc/passwd, /etc/spwd.db, and /etc/pwd.db files contain usernames and passwords, along with a few other key items about locally defined users. When you log in, the password you type is compared with the encrypted and salted hash of your password in this file. As such, /etc/master.passwd is vital to system security.

Editing /etc/master.passwd

If you’re considering editing /etc/master.passwd directly, stop. Go back to Chapter 6. Reread it. See if there’s another way to make your desired change. Damaging /etc/master.passwd can prevent people from logging in at all, and might render your system unusable. To edit a single user account in /etc/master.passwd, run chpass(1) as root.

If you must edit /etc/master.passwd directly—say, to change everyone’s home directory to point to a new filesystem—there’s a program just for that. The program vipw(8) calls up the text editor in $EDITOR, loads the password file, lets you make changes, and checks the file syntax before saving it. vipw also updates /etc/passwd and the password databases /etc/pwd.db and /etc/spwd.db.

Be absolutely sure that this file is synchronized with the password databases. Using vipw prevents many basic mistakes and helps ensure data consistency, but if you’re really bent on corrupting /etc/master.passwd, vipw(8) will make your task more difficult but won’t stop you.

That said, only senior sysadmins should use vipw. How do you know if you qualify? If you’ve made enough horrible mistakes with vipw that you know in your bones not to use it, if your stomach churns at the mere thought of typing those four letters, you may use vipw.

Controlling Account Information Access

Many programs need parts of the information stored in /etc/master.passwd. For example, a program must be able to look up a user’s shell and home directory to properly find the user’s files. Rather than allowing anyone to read this file and the scrambled passwords therein, OpenBSD (and most other Unix-like systems) provide the account information everyone needs to see in /etc/passwd.

Accessing and parsing a text file can be slow, especially if the computer has a slow processor and many user accounts. Text files are not meant for searching. If a program must search a text file for user account number 10631, the search can hold up the program’s activity and even block other programs. Checking a database for an entry is much faster, as the program can just say “Give me account 10631” and get a response from a file store intended for searches.

All Unix-like systems create databases from the password files whenever the account information changes. The database of public account information, built from /etc/passwd, is /etc/pwd.db. The database file /etc/spwd.db contains private account information built from /etc/master.passwd.

Realistically, very few pieces of software actually use the password file directly. Most programs access pwd.db. I know people who delete /etc/passwd without ill effect, but you do need to keep the password database.

/etc/master.passwd Fields

Each account is a line in /etc/master.passwd and /etc/passwd. Each line has the following nine fields, separated by colons.

Username

This field contains either an account created by the sysadmin and used by a human, or a nonprivileged user created for use by a program or service. Chapter 6 covers usernames.

Hashed and Salted Password

This field contains the user’s password, hashed and salted. (It’s commonly called a hash, but you should know it’s more than that.) You cannot derive the password from the hash, but if you have the hash, you can try passwords until you find one that matches the hash. That’s why you must protect your /etc/master.passwd file. In /etc/passwd, the password field is blank.

Note

One simple way to temporarily disable a user account is to edit the password file with chpass(1) and put an asterisk (*) in front of the hash. While the account will still be active, no one will be able to log in to it. I’ve used this to great effect when a client is behind on a bill. While clients can ignore overdue payment notices, they call quite quickly when they cannot access their account. I can easily route that call to the billing department. Once the matter is resolved, I can re-enable their account by removing the asterisk.

User ID Number

The third field is the user ID number, or UID. Every user must have a unique UID.

Group ID Number

This field is the group ID number, or GID. This is the user’s primary group, as discussed in Chapter 6. Usually, this is the same as the UID, and the user’s primary group has the same name as the username. Some sites prefer to use a single group for all unprivileged users.

User Class

We discuss the user class in Chapter 6. Changing the class can increase or decrease the amount of system resources the user can access.

Password Expiration Date

The expiration date is expressed in the number of seconds since midnight, January 1, 1970, the UNIX epoch. You can convert dates to seconds with date(1). If you must manually set an expiration date for a password, use chpass(1) and specify a human-readable date.

Gecos

This field contains the user’s real name, office number, work phone number, and home phone number, all separated by commas. This information was much more important when computers were big systems with hundreds or thousands of users, and you might need to contact people when their process went completely insane. Today, it’s basically ignored. (Do not use colons here; colons are reserved specifically for separating fields in /etc/master.passwd.)

User’s Home Directory

This field is the user’s home directory. While this defaults to a directory with the same name as the username, beneath /home, you can move this directory anywhere you like. Editing the home directory in the password file does not move the actual directory; you need to do that yourself.

User’s Shell

The last field gives the user’s shell. If this field is empty, the user gets boring old /bin/sh.

/etc/mixerctl.conf

OpenBSD includes solid audio abilities. You can listen to MP3s, mix music, or just about anything else you would like.

Control audio settings with mixectl(8), and set boot-time mixerctl settings in /etc/mixerctl.conf.

/etc/mk.conf

Configure make(1) with /etc/mk.conf. The most common use for special make settings is while you are building ports (covered in Chapter 13) or while building your own custom OpenBSD release (Chapter 20).

/etc/moduli

The /etc/moduli file contains prime numbers, used for Diffie-Hellman cryptography. Never edit this file. Some people may understand cryptography well enough to edit /etc/moduli, but if you’re reading this book, you’re probably not one of them.[40]

/etc/monthly and /etc/monthly.local

The /etc/monthly.local shell script runs once per month as part of routine system maintenance. Chapter 15 discusses scheduled maintenance jobs.

/etc/motd

The MOTD, or message of the day, is displayed to users upon login. In this file, you might put system notices or announcements that you hope users will notice. Many organizations put legal notices or acceptable use policies in /etc/motd.

Note that the first line of /etc/motd is overwritten at every boot. Start your legal warning in line 2 or below.

/etc/mrouted.conf

In addition to dvmrpd(8), OpenBSD supports multicast routing with mrouted(8). The dvmrpd implementation is preferred, but for specific edge cases, you might need mrouted instead.

Configure mrouted in /etc/mrouted.conf. Eventually, mrouted will be removed from OpenBSD.

/etc/mtree/

The /etc/mtree/ directory contains a list of most directories on a stock OpenBSD system, with their ownership and permissions. The system upgrade process uses this. While you don’t really need to edit these files, it’s nice to know what the heck they’re for.

/etc/mygate

The /etc/mygate script gives the address of the default gateway for both IPv4 and IPv6, as discussed in Chapter 12.

/etc/myname

The /etc/myname file contains the hostname of the system, as discussed in Chapter 4.

/etc/netstart

The /etc/netstart script starts the network, as discussed in Chapter 12.

/etc/networks

/etc/networks is a list of subnets and their names. Use of a networks database has fallen out of favor, because it’s not terribly useful.

/etc/newsyslog.conf

The newsyslog(8) program rotates log files, as discussed in Chapter 15.

/etc/nginx/

OpenBSD has imported the nginx web server (http://www.nginx.org/) as a replacement for the older Apache 1.3 server, but as of this writing, it’s not quite integrated with the rest of the system. You can find the nginx configuration files in this directory, and the server is quite usable, but it’s not the official OpenBSD web server—yet.

/etc/nsd.conf

OpenBSD has imported the name server daemon nsd(8) to eventually partially replace the old DNS workhorse server named(8). It’s usable, but as of this writing, it’s not yet integrated with the system.

/etc/ntpd.conf

The NTP daemon keeps the system time synchronized with other machines on your network and the Internet. We discuss ntpd(8) in Chapter 15.

/etc/ospf6d.conf and /etc/ospfd.conf

OSPF is a routing protocol used inside autonomous networks. OpenBSD has two OSPF implementations: one for IPv4 and one for IPv6. If you want to know more about OSPF, read ospfd(8) and ospf6d(8).

/etc/pf.conf and /etc/pf.os

Configure the OpenBSD pf(4) packet filter in /etc/pf.conf. Packet filtering uses /etc/pf.os to fingerprint other operating systems. Chapter 21 and Chapter 22 cover packet filtering.

/etc/ppp/

You can connect OpenBSD to the Internet via a dial-up modem, which is rarely done these days. If you need to configure a modem on your OpenBSD system, read the ppp(8) man page.

/etc/printcap

The printer capability file describes all printers that this system can access. Making a Unix-like system work with a random printer was long considered to require some sort of sacrifice, a moon in the correct phase, and a team of chanting acolytes in robes. While complicated software such as CUPS has been written to simplify printing, configuring an OpenBSD machine to print to a print server or a network PostScript printer is pretty simple. See Chapter 16 for details on printing.

/etc/protocols

The /etc/protocols file contains protocol numbers for TCP/IP network protocols. Chapter 11 covers TCP/IP versions 4 and 6 in detail.

/etc/rbootd.conf

rbootd(8) offers boot services for HP workstations—a very narrow subset of obsolete diskless clients. OpenBSD still supports the HP300 machines that need this service. If you’re interested in diskless operations on modern hardware, read the diskless(8) man page instead, or look at Chapter 23.

/etc/rc.*

The /etc/rc.* files are used for system booting, as discussed in tortuous detail in Chapter 5.

/etc/relayd.conf

The load balancer daemon relayd(8) works with the OpenBSD Packet Filter (PF) system to act as a network load balancer. The relayd daemon requires a good understanding of PF, however, and a very specific network. If you’re interested in load balancing, read Hansteen’s The Book of PF.

/etc/remote

Unix-like systems have extensive support for connecting into the system over serial lines, usually for serial consoles. Many network appliances have management serial ports, and you can use OpenBSD as a client to configure these devices. The /etc/remote file contains serial connection configurations for most common modern serial connections (covered in Chapter 5).

/etc/resolv.conf and /etc/resolv.conf.tail

The /etc/resolv.conf and /etc/resolv.conf.tail files configure the resolver (covered in Chapter 12), letting the host map names to IP addresses and vice versa.

/etc/ripd.conf

RIP is an old way to broadcast routing instructions across a network. OpenBSD has a RIP daemon, ripd(8), configured in /etc/ripd.conf.

RIP is generally considered undesirable, like the r-services. Among other shortcomings, it doesn’t even support netmasks, so it’s restricted to old-style class A, B, and C networks. And as with the r-services, sometimes you’re stuck with RIP because some obsolete device on your network can handle nothing else. Use ripd to scrape by until you can arrange a tragic accident for that device.

/etc/rmt

The remote magnetic tape command (rmt) lets a host access a tape drive on another machine. It’s most commonly used to restore a system from backup.

/etc/rpc

RPC is a method for executing commands on a remote server. Much like TCP/IP, RPC has service and port numbers. The file /etc/rpc contains a list of these services and port numbers. The most common RPC consumer in OpenBSD is NFS, as discussed in Chapter 9.

/etc/sasyncd.conf

OpenBSD supports failover between IPsec gateways, using the security association synchronization daemon sasyncd(8). This is not a common feature in operating systems, and its presence is a highlight in OpenBSD. To learn about IPsec failover, read sasyncd(8).

/etc/sensorsd.conf

Modern hardware has sensors for detecting items like fan speed, circuit voltage, temperature, and so on. OpenBSD’s sensord(8) reads these sensors and presents the information to the user. Configure which sensors you want to pay attention to, as well as what you want to do when the sensors detect something, in /etc/sensorsd.conf. See Chapter 15 for details on sensorsd.

/etc/services

The /etc/services file contains a list of network services and their associated TCP/IP ports. See Chapter 11 for details.

/etc/shells

The /etc/shells file contains a list of legitimate user shells, as discussed in Chapter 6.

/etc/skel/

The /etc/skel/ directory contains standard user environment configuration files. When you create a user account, adduser(8) copies the files in this directory to the new user’s home directory. This directory can be overwritten when you upgrade your system.

If you need to customize these files for your users, create a custom dotfile directory and tell adduser(8) to use it instead.

/etc/sliphome/

The Serial Line Internet Protocol (SLIP) predated the Point-to-Point Protocol (PPP) commonly used for dial-up lines. OpenBSD still supports it, as someone might need it and there’s no real reason to get rid of it.

/etc/snmpd.conf

Simple Network Management Protocol (SNMP) is a method for accessing information about a device over the network. Unfortunately, it’s not a terribly secure protocol (one common acronym for SNMP is “Security? Not My Problem!”) The OpenBSD team has written a more secure SNMP daemon, snmpd(8). Configure it in /etc/snmpd.conf, as discussed in Chapter 16.

While OpenBSD’s SNMP daemon might resist intrusions and abuse, it can’t help the fact that SNMP itself, as commonly deployed, isn’t terribly secure.

/etc/ssh/

The SSH daemon sshd(8) offers a secure replacement for telnet(1) and the r-protocols. Chapter 16 includes a brief discussion of SSH.

/etc/ssl/

The /etc/ssl/ directory is for Secure Sockets Layer (SSL) certificates, as well as the OpenSSL configuration file openssl.cnf. Store system SSL certificates here.

/etc/sudoers

The /etc/sudoers file controls sudo(1) configuration. See Chapter 7 for details about sudo.

/etc/sysctl.conf

Set kernel runtime tunable options in /etc/sysctl.conf. Sysctls are covered in Chapter 18.

/etc/syslog.conf

The logging daemon syslogd(8) reads messages from programs and hosts, and then separates those messages into records based on the configuration in /etc/syslog.conf. See Chapter 15 for details on syslogd.

/etc/systrace/

The systrace(4) system call wrapper provides access controls to system calls. You could run a binary “under” systrace(1), and if the program attempted to access any system call beyond those permitted in the application’s systrace policy, systrace would block the access.

Flaws were found in systrace, however, that make it less than effective, and it’s now considered only a partial solution. It still ships with OpenBSD, but its use is discouraged. Today, systrace is mostly used for package-building clusters to make sure that software built doesn’t phone home or write outside the fake installation root.

If you need to use systrace, store policies in /etc/systrace.

/etc/termcap

The /etc/termcap file describes all the different terminals that OpenBSD supports. Pretty much every console device now supports the standard VT220 terminal, however.

/etc/ttys

Configure system terminals in /etc/ttys. You can enable, disable, and change terminals here. A “terminal” could be the keyboard and monitor attached to the computer, a login over a serial line as with a serial console, or a virtual terminal as used by telnet or SSH.

A classic UNIX terminal device resembled a teletype; that’s where the tty label comes from. All sorts of UNIX architectural details descend from this historical accident, and Unix-like systems inherited them.

Terminal Types

/etc/ttys lists three different terminal types: the console, serial ports, and pseudo-terminals.

The console is where boot messages display, where single-user mode maintenance can happen, and where error messages directed at the console appear. While the console is usually the keyboard, monitor, and mouse attached to the computer, it doesn’t need to be that. The “console” is an abstraction that usually happens to be aimed at your physical monitor and keyboard. You can direct the console at a serial port instead, for example. The console uses the device /dev/console.

On some platforms, including i386 and amd64, OpenBSD supports multiple virtual consoles attached to your physical console. If you press CTRL-ALT-F2 on the physical keyboard, you’ll see a brand-new login screen. CTRL-ALT-F1 returns you to the main console. You can have as many virtual consoles as you have function keys, but OpenBSD has five by default. These virtual consoles have device names beginning with /dev/ttyC and ending in a hexadecimal number.

Serial ports can be used as login devices, once you attach either an old-fashioned serial terminal or a null-modem cable and another device with a serial port. They can also be used for outgoing serial connections. Serial ports used as incoming devices start with /dev/tty, while ports used for outgoing connections start with /dev/cua, and both end in hexadecimal numbers. Each serial port can have one terminal attached to it.

Pseudo-terminals support network connections. Even though your remote SSH window has no corresponding physical hardware on the server, OpenBSD treats it in some way as a tty device. Pseudo-terminals have device names beginning with /dev/tty, a letter p through z (either lowercase or uppercase), and ending in a single letter or number. When a user connects over the network, such as via SSH, the login session is assigned one of these virtual terminal devices.

Whatever the terminal type is, configure it in /etc/ttys, using the following procedure.

Configuring Terminals

Each terminal has an /etc/ttys entry, containing at least three entries and possibly up to five.

ttyC0 /usr/libexec/getty std.9600 vt220 on secure

The first entry is the device name, without the leading /dev.

The second entry is the name of the program that spawns login requests on the terminal. Physical terminals and virtual consoles use getty(8), while pseudo-terminals process login requests through whatever daemon the user logs in through.

The third entry is the terminal type. OpenBSD uses a vt220 terminal on the monitor and the virtual consoles. Serial consoles use the unknown terminal type, as there’s no way to know in advance what kind of hardware is on the other end of the terminal. (You can switch this to vt220 without issue if you’re using a reasonably modern serial client.) Pseudo-terminals use the network terminal type; the server daemon and client software determine the terminal’s features.

The fourth field determines if the terminal is available for logins. Set this to on to accept login requests, or off to deny them. Pseudo-terminals are activated on demand, so you don’t need to configure them in /etc/ttys.

The root account can log on to only a secure console. The physical terminal and the console are the only devices defined as secure by default. You can log in as a regular user and use su(1) or sudo(1) on an insecure terminal; you just can’t directly log on as straight root. This means that anyone who has the root password and physical access to the machine can just walk up to the keyboard and log in as root. To disallow logins directly to root, remove the secure keyword from the virtual console entries in /etc/ttys. Also, on secure terminals, you won’t be asked for the root password when you boot into single-user mode.

If you use serial consoles, you might want to log in to a running multiuser system over the serial cable. By default, you cannot log in on a serial line. Set the serial line with the serial console to on, and you’ll be able to log in. This makes a serial line behave much like being at the physical console, where you can work in multiuser mode and while the machine is running normally.

While all of the defaults use getty(8), there are alternatives. For example, the HylaFAX package lets you connect a fax machine to a serial line, but you need to reconfigure the terminal to support it.

tty0e   "/usr/local/sbin/faxgetty"      dialup  on

The point is that you can use serial ports any way you like, once you get the right software tool for the job.

Making /etc/ttys Changes Take Effect

Offering terminals is a low-level system task handled directly by init(8). Changes to /etc/ttys do not take effect until you tell init to reread its configuration. (init is always process ID 1.)

# kill -HUP 1

If you don’t tell init to reread its configuration, changes won’t take effect until you reboot.

/etc/weekly and /etc/weekly.local

The /etc/weekly.local script runs once a week to perform weekly maintenance, as discussed in Chapter 15.

/etc/wsconsctl.conf

OpenBSD includes hardware-independent access to the physical console through the wscons(4) driver. Configure this console via wsconsctl(8). The boot-time wsconsctl settings are read from /etc/wsconsctl.conf. See Chapter 17 for details on console configuration.

/etc/X11

The /etc/X11 directory contains configuration for the X Window System. OpenBSD’s Xenocara integrates X with the base system. Chapter 17 discusses desktop OpenBSD, including some X features.

/etc/ypldap.conf

In addition to the LDAP daemon ldapd(8), OpenBSD supports the YP database for centralizing passwords, groups, and host filesystems. YP is compatible with Sun’s original Network Information System (NIS). OpenBSD uses YP as a gateway to LDAP authentication. If you’re interested in this feature, see yp(8) and ypldap(8).

This takes you through everything in /etc not covered elsewhere. In the next chapter, we’ll discuss how OpenBSD maintains itself, and how you can meddle with the maintenance processes.



[39] If Wireshark has a shaky security history, why would I install it? Because, sadly, it’s still the easiest way to debug really complicated network problems, especially when you’re working with an unfamiliar protocol.

[40] Henning Brauer, OpenBSD developer and point man on packet filtering, comments, “I understand crypto somewhat well. … I don’t muck with moduli either tho.” Consider yourself warned.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.31.163