Table of contents for Secure architectures with OpenBSD / Jose Nazario, Brandon Palmer.


Bibliographic record and links to related information available from the Library of Congress catalog. Note: Contents data are machine generated based on pre-publication information provided by the publisher. Contents may have variations from the printed book or be incomplete or contain other coding.


Counter
Contents
1 Introduction 17
1.1 What will this book cover? . . . . . . . . . . . . . . . . . . . . . 17
1.2 Whom is this book for? . . . . . . . . . . . . . . . . . . . . . . . 20
1.3 Book Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.4 About the authors . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4.1 Brandon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4.2 Jose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4.3 Contributing Authors . . . . . . . . . . . . . . . . . . . . 21
1.5 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . 21
I Getting Started 23
2 Overview of OpenBSD 25
2.1 A Brief History of OpenBSD . . . . . . . . . . . . . . . . . . . . 25
2.2 OpenBSD Security . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.1 The OpenBSD Security Model . . . . . . . . . . . . . . . 26
2.2.2 The Audit . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2.3 Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2.4 Proactive Security . . . . . . . . . . . . . . . . . . . . . . 28
2.2.5 Which Applications Are and Are Not Secure? . . . . . . . 28
2.3 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.4 The Feel of OpenBSD . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4.1 Filesystem Layout . . . . . . . . . . . . . . . . . . . . . . 29
2.4.2 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4.3 User Friendliness . . . . . . . . . . . . . . . . . . . . . . . 30
2.5 Packages and Ports . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.6 Where is OpenBSD used? . . . . . . . . . . . . . . . . . . . . . . 30
3 Installation 33
3.1 Supported Hardware . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 System Preparation . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3 Getting the Files for Installation . . . . . . . . . . . . . . . . . . 35
3.4 Selecting Boot Media . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5 Booting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.5.1 The Boot Configuration . . . . . . . . . . . . . . . . . . . 36
3.5.2 Creating a Serial Console . . . . . . . . . . . . . . . . . . 36
3.5.3 Platform Specific Information . . . . . . . . . . . . . . . . 38
3.5.4 Boot Example . . . . . . . . . . . . . . . . . . . . . . . . 39
3.6 Filesystem Partitioning . . . . . . . . . . . . . . . . . . . . . . . 39
3.6.1 A Private System . . . . . . . . . . . . . . . . . . . . . . . 40
3.6.2 A Multiuser System with Untrusted Users . . . . . . . . . 40
3.6.3 Server Partitioning . . . . . . . . . . . . . . . . . . . . . . 41
3.6.4 Firewall . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.6.5 Swap Space Allocation . . . . . . . . . . . . . . . . . . . . 42
3.6.6 Example Partitioning . . . . . . . . . . . . . . . . . . . . 42
3.7 Network Configuration . . . . . . . . . . . . . . . . . . . . . . . . 45
3.7.1 Example Network Setup . . . . . . . . . . . . . . . . . . . 45
3.8 Base Software Set Installation . . . . . . . . . . . . . . . . . . . . 46
3.8.1 Types of Installation . . . . . . . . . . . . . . . . . . . . . 46
3.8.2 Descriptions of the Installation Sets . . . . . . . . . . . . 47
3.8.3 Example Installation . . . . . . . . . . . . . . . . . . . . . 48
3.9 Post Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.9.1 Time Zone Information and Example . . . . . . . . . . . . 49
3.9.2 After Reboot . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.10 Customizing the Install Process . . . . . . . . . . . . . . . . . . . 50
3.10.1 Creating Site Specific Files . . . . . . . . . . . . . . . . . 50
3.10.2 Jumpstarting Installations . . . . . . . . . . . . . . . . . . 51
3.10.3 Customized Install Floppies . . . . . . . . . . . . . . . . . 52
3.11 Upgrading an Installation . . . . . . . . . . . . . . . . . . . . . . 53
4 Basic Use 55
4.1 General File System Layout . . . . . . . . . . . . . . . . . . . . . 55
4.1.1 /bin and /sbin . . . . . . . . . . . . . . . . . . . . . . . 55
4.1.2 /usr/bin and /usr/sbin . . . . . . . . . . . . . . . . . . 56
4.1.3 /var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.1.4 /tmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.1.5 /usr/local . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.1.6 /home . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.1.7 /dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.1.8 /sys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.1.9 /stand . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.2 Startup and Shutdown . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3 Logging In . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4 RC Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.5 Default Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.5.1 Random PID Values . . . . . . . . . . . . . . . . . . . . . 67
4.6 Ports and Packages . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.7 Networking in Brief . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.8 APM - Automatic Power Management . . . . . . . . . . . . . . . 68
4.9 Mouse Control with wsmoused . . . . . . . . . . . . . . . . . . . 69
5 Basic Default Services 71
5.1 inetd - The Super Server . . . . . . . . . . . . . . . . . . . . . . . 71
5.1.1 The Use of TCP Wrappers . . . . . . . . . . . . . . . . . 73
5.2 syslog - The Logging Service . . . . . . . . . . . . . . . . . . . . . 74
5.3 Electronic Mail with sendmail . . . . . . . . . . . . . . . . . . . . 75
5.4 The Secure Shell Server sshd . . . . . . . . . . . . . . . . . . . . 75
6 Online Help Resources 79
6.1 Manual Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.1.1 Which Manual Page? . . . . . . . . . . . . . . . . . . . . 80
6.1.2 The Layout of the Manual . . . . . . . . . . . . . . . . . . 81
6.1.3 Notable Manual Pages . . . . . . . . . . . . . . . . . . . . 82
6.1.4 Added Sections . . . . . . . . . . . . . . . . . . . . . . . . 82
6.1.5 Writing Your Own Manual Pages . . . . . . . . . . . . . . 83
6.2 GNU Info Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.2.1 Converting Info to Manual Pages . . . . . . . . . . . . . . 84
6.3 Perldoc and Pod . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.4 Package Specific Documentation . . . . . . . . . . . . . . . . . . 86
6.5 Other Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7 X Window System 87
7.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.2 Quick Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.2.1 Troubleshooting Configuration . . . . . . . . . . . . . . . 90
7.3 xdm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.4 Window Managers . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.5 Basic X Applications . . . . . . . . . . . . . . . . . . . . . . . . . 92
7.6 Remote Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.7 X and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
II System Configuration and Administration 95
8 User Administration 97
8.1 User Creation and Deletion . . . . . . . . . . . . . . . . . . . . . 97
8.1.1 Altering the Default New User Options . . . . . . . . . . 100
8.2 vipw and Group Management . . . . . . . . . . . . . . . . . . . . 100
8.2.1 Self Account Administration for Users . . . . . . . . . . . 100
8.3 User Limits with ulimit . . . . . . . . . . . . . . . . . . . . . . . 101
8.4 Process Accounting . . . . . . . . . . . . . . . . . . . . . . . . . . 102
8.5 Privileged Users with sudo . . . . . . . . . . . . . . . . . . . . . . 104
8.5.1 The sudoers File . . . . . . . . . . . . . . . . . . . . . . . 104
8.5.2 Logging with sudo . . . . . . . . . . . . . . . . . . . . . . 105
8.5.3 Security of sudo . . . . . . . . . . . . . . . . . . . . . . . 106
8.6 Restricted Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
8.7 Restricting Users with Systrace . . . . . . . . . . . . . . . . . . . 107
9 Networking 109
9.1 Device Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
9.1.1 Virtual Interface Drivers . . . . . . . . . . . . . . . . . . . 109
9.1.2 Kernel Messages . . . . . . . . . . . . . . . . . . . . . . . 111
9.2 Basic Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.2.1 Interface Media Options . . . . . . . . . . . . . . . . . . . 113
9.3 DNS Client Configuration . . . . . . . . . . . . . . . . . . . . . . 114
9.4 DHCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
9.5 Alias Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
9.6 Address Resolution Protocol, ARP . . . . . . . . . . . . . . . . . 116
9.6.1 Diagnostic Information . . . . . . . . . . . . . . . . . . . . 117
9.7 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
9.8 Bridging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
9.9 PPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
9.9.1 User Dialup with PPP . . . . . . . . . . . . . . . . . . . . 122
9.10 Listening Ports and Processes . . . . . . . . . . . . . . . . . . . . 123
9.11 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
10 inetd 125
10.1 ftpd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
10.1.1 sftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
10.2 telnetd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
10.3 shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.4 fingerd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.5 identd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
10.6 comsat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
10.7 ntalkd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.8 popa3d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.9 Internal Services . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.10Kerberos Services . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
10.11RPC Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
11 Other Installed Services 133
11.1 tftpd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
11.2 rarpd / bootparamd . . . . . . . . . . . . . . . . . . . . . . . . . 133
11.3 The Remote Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
11.4 Time Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
11.5 Mouse services . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.6 Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.7 dhcpd - The DHCP Server . . . . . . . . . . . . . . . . . . . . . . 137
11.7.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 138
11.7.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 138
11.7.3 Starting dhcpd . . . . . . . . . . . . . . . . . . . . . . . . 139
15 Backup Utilities 173
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
15.2 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
15.3 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
15.4 Backup Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . 174
15.4.1 Data Specific Options . . . . . . . . . . . . . . . . . . . . 176
15.4.2 Authentication . . . . . . . . . . . . . . . . . . . . . . . . 177
15.5 Available Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.5.1 cpio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.5.2 pax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
15.5.3 dump and restore . . . . . . . . . . . . . . . . . . . . . . . 180
15.5.4 tar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
15.6 Additional Tools from Ports and Packages . . . . . . . . . . . . . 183
15.6.1 Amanda . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
15.6.2 GNU Tar for Backups . . . . . . . . . . . . . . . . . . . . 185
15.6.3 Backup using rsync . . . . . . . . . . . . . . . . . . . . . . 185
16 Housekeeping 189
16.1 What is Housekeeping . . . . . . . . . . . . . . . . . . . . . . . . 189
16.2 Regular System Scripts . . . . . . . . . . . . . . . . . . . . . . . 189
16.2.1 Daily Checks . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.2.2 Weekly Checks . . . . . . . . . . . . . . . . . . . . . . . . 191
16.2.3 Monthly Checks . . . . . . . . . . . . . . . . . . . . . . . 191
16.3 Logfile Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
16.4 Scheduling Facilities . . . . . . . . . . . . . . . . . . . . . . . . . 192
16.4.1 The cron System . . . . . . . . . . . . . . . . . . . . . . . 192
16.4.2 at . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
16.4.3 Controlling Execution of at Jobs . . . . . . . . . . . . . . 195
17 Mail Server Operations 197
17.1 Introduction to Electronic Mail . . . . . . . . . . . . . . . . . . . 197
17.2 Overview of Electronic Mail in OpenBSD . . . . . . . . . . . . . 198
17.3 Sendmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
17.4 Virtual Hosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
17.5 Security with STARTTLS . . . . . . . . . . . . . . . . . . . . . . 201
17.6 Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
17.7 POP Server Administration . . . . . . . . . . . . . . . . . . . . . 203
17.8 IMAP Server Administration . . . . . . . . . . . . . . . . . . . . 203
17.9 Mailing List Software . . . . . . . . . . . . . . . . . . . . . . . . . 204
17.10Email Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
17.10.1MTA Security . . . . . . . . . . . . . . . . . . . . . . . . . 204
17.10.2POP Security . . . . . . . . . . . . . . . . . . . . . . . . . 205
17.10.3 Message Security . . . . . . . . . . . . . . . . . . . . . . . 205
20.5 Privsep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
20.6 sftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
III Advanced 239
21 The OpenBSD Development Environment 241
21.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
21.2 Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
21.3 Compilers and Languages . . . . . . . . . . . . . . . . . . . . . . 242
21.3.1 Base Language Support . . . . . . . . . . . . . . . . . . . 242
21.3.2 Default Security Options . . . . . . . . . . . . . . . . . . 244
21.4 Additional Languages from Ports . . . . . . . . . . . . . . . . . . 245
21.5 Debuggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
21.5.1 Additional Debugging Tools from Ports . . . . . . . . . . 248
21.5.2 Tracing System Calls . . . . . . . . . . . . . . . . . . . . . 248
21.5.3 Additional Source Code Development Tools . . . . . . . . 249
21.6 Make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
21.6.1 Automake . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
21.6.2 Imake and xmkmf . . . . . . . . . . . . . . . . . . . . . . 251
21.7 Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
21.8 Shared Library and Object Tools . . . . . . . . . . . . . . . . . . 252
21.9 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
22 Packet Filtering and NAT 255
22.1 Introduction to Firewalls . . . . . . . . . . . . . . . . . . . . . . . 255
22.2 Introduction to PF . . . . . . . . . . . . . . . . . . . . . . . . . . 256
22.2.1 The PF Configuration File . . . . . . . . . . . . . . . . . 257
22.3 Firewalls with PF . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
22.4 Introduction to Network Address Translation . . . . . . . . . . . 261
22.5 NAT with PF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
22.6 Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
22.7 Advanced PF Usage . . . . . . . . . . . . . . . . . . . . . . . . . 262
22.7.1 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
22.7.2 Anchors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
22.7.3 Packet Scrubbing . . . . . . . . . . . . . . . . . . . . . . . 265
22.7.4 Rate Limiting . . . . . . . . . . . . . . . . . . . . . . . . . 266
22.7.5 Transparent Filtering . . . . . . . . . . . . . . . . . . . . 268
22.7.6 Load Balancing . . . . . . . . . . . . . . . . . . . . . . . . 268
22.8 Selective Filtering based on OS . . . . . . . . . . . . . . . . . . . 269
22.9 Logging with pflogd . . . . . . . . . . . . . . . . . . . . . . . . . 270
22.10Examining the State Table with pfsync . . . . . . . . . . . . . . 271
22.11Determining Firewall Rules . . . . . . . . . . . . . . . . . . . . . 273
22.11.1Opening Ports . . . . . . . . . . . . . . . . . . . . . . . . 273
22.12Authenticated Firewall Rules . . . . . . . . . . . . . . . . . . . . 274
22.13Firewall Performance Tuning . . . . . . . . . . . . . . . . . . . . 275
23 NFS - The Network Filesystem 277
23.1 Introduction to NFS . . . . . . . . . . . . . . . . . . . . . . . . . 277
23.2 NFS Client Configuration . . . . . . . . . . . . . . . . . . . . . . 277
23.3 NFS Server Configuration . . . . . . . . . . . . . . . . . . . . . . 278
23.3.1 Kernel Configuration . . . . . . . . . . . . . . . . . . . . . 278
23.3.2 Configuration of the Server . . . . . . . . . . . . . . . . . 278
23.4 NFS Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
24 NIS and YP Services 283
24.1 Introduction to NIS . . . . . . . . . . . . . . . . . . . . . . . . . 283
24.2 Client Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
24.3 Server Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
24.4 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
24.5 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
25 Kerberos 287
25.1 What is Kerberos? . . . . . . . . . . . . . . . . . . . . . . . . . . 287
25.1.1 Why Use Kerberos? . . . . . . . . . . . . . . . . . . . . . 288
25.2 Key Concepts in Kerberos . . . . . . . . . . . . . . . . . . . . . . 288
25.3 Overall System Setup . . . . . . . . . . . . . . . . . . . . . . . . 289
25.3.1 Clock Synchronization . . . . . . . . . . . . . . . . . . . . 289
25.3.2 Build Support for Kerberos . . . . . . . . . . . . . . . . . 290
25.4 Client Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
25.4.1 Client Configuration . . . . . . . . . . . . . . . . . . . . . 290
25.4.2 Obtaining Tickets . . . . . . . . . . . . . . . . . . . . . . 291
25.5 Kerberos Server Setup . . . . . . . . . . . . . . . . . . . . . . . . 292
25.5.1 KDC Configuration . . . . . . . . . . . . . . . . . . . . . 292
25.5.2 Keytab Creation . . . . . . . . . . . . . . . . . . . . . . . 292
25.5.3 Initialize the Realm . . . . . . . . . . . . . . . . . . . . . 293
25.5.4 Controlling Access to the Admin Server . . . . . . . . . . 293
25.5.5 Starting the Kerberos Server . . . . . . . . . . . . . . . . 294
25.5.6 Starting Kerberos V Services at Boot . . . . . . . . . . . 294
25.5.7 Server Logging . . . . . . . . . . . . . . . . . . . . . . . . 295
25.6 Kerberizing Services . . . . . . . . . . . . . . . . . . . . . . . . . 295
25.6.1 Secure Shell . . . . . . . . . . . . . . . . . . . . . . . . . . 295
25.6.2 Telnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
25.7 Windows 2000 and Kerberos V . . . . . . . . . . . . . . . . . . . 296
25.8 Security of the Kerberos Scheme . . . . . . . . . . . . . . . . . . 296
25.9 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
25.10Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
26 Authentication Methods 299
26.1 Authentication Overview . . . . . . . . . . . . . . . . . . . . . . . 299
26.2 passwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
26.3 skey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
26.3.1 S/Key Setup . . . . . . . . . . . . . . . . . . . . . . . . . 300
26.3.2 Getting Passphrases . . . . . . . . . . . . . . . . . . . . . 300
26.3.3 SSHd Setup and Usage with S/Key . . . . . . . . . . . . . 301
26.4 Additional Login Classes . . . . . . . . . . . . . . . . . . . . . . . 302
26.4.1 lchpass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
26.4.2 chpass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
26.4.3 Token Based Authentication Methods . . . . . . . . . . . 303
26.4.4 Kerberos . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
26.4.5 radius Method . . . . . . . . . . . . . . . . . . . . . . . . 304
26.4.6 reject Method . . . . . . . . . . . . . . . . . . . . . . . . . 304
27 IPsec: Security at the IP Layer 305
27.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
27.2 IPsec basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
27.2.1 URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
27.2.2 Creating x509 keys . . . . . . . . . . . . . . . . . . . . . . 306
27.3 Setting up IPsec . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
27.3.1 Kernel Requirements . . . . . . . . . . . . . . . . . . . . . 307
27.4 Endpoint Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
27.4.1 Manual Configuration . . . . . . . . . . . . . . . . . . . . 308
27.4.2 Automatic Configuration . . . . . . . . . . . . . . . . . . 308
27.5 Testing/Debugging the Configuration . . . . . . . . . . . . . . . . 309
27.5.1 tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
27.5.2 ipsecadm monitor . . . . . . . . . . . . . . . . . . . . . . . 310
27.5.3 /kern/ipsec . . . . . . . . . . . . . . . . . . . . . . . . . . 310
27.5.4 /var/run/isakmpd.pcap . . . . . . . . . . . . . . . . . 310
27.5.5 /var/run/isakmpd.report . . . . . . . . . . . . . . . . 310
27.5.6 netstat -nr . . . . . . . . . . . . . . . . . . . . . . . . . . 310
27.6 Example VPN Configurations . . . . . . . . . . . . . . . . . . . . 311
27.6.1 Transport: OBSD - OBSD + Tunnel: Net - Net . . . . . 311
27.6.2 Transport: None + Tunnel: Net - Net . . . . . . . . . . . 315
27.6.3 Transport: OBSD - OBSD + Tunnel: None . . . . . . . . 317
27.6.4 Wireless Laptop to a Secure Gateway . . . . . . . . . . . 319
27.6.5 OBSD - OBSD through an OBSD PF nat firewall . . . . 322
28 IP Version 6, IPv6 327
28.1 How IPv6 Works . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
28.1.1 Special Addresses . . . . . . . . . . . . . . . . . . . . . . . 329
28.1.2 Tunelling IPv4 and IPv6 . . . . . . . . . . . . . . . . . . . 330
28.1.3 Kernel Setup . . . . . . . . . . . . . . . . . . . . . . . . . 330
28.1.4 Userland Setup . . . . . . . . . . . . . . . . . . . . . . . . 330
28.2 Normal Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
28.2.1 Manual Configuration . . . . . . . . . . . . . . . . . . . . 331
28.2.2 Configuring a Router for IPv6 . . . . . . . . . . . . . . . 331
28.2.3 Configuring a Host for IPv6 Automatically . . . . . . . . 332
28.3 Getting on the IPv6 Network . . . . . . . . . . . . . . . . . . . . 334
28.3.1 Freenet6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
28.3.2 IPv4 and IPv6 Proxying . . . . . . . . . . . . . . . . . . . 337
28.4 Some Applications That are IPv6 Ready . . . . . . . . . . . . . . 338
28.5 Service Support for IPv6 . . . . . . . . . . . . . . . . . . . . . . . 339
28.5.1 Sendmail . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
28.5.2 Secure Shell Daemon . . . . . . . . . . . . . . . . . . . . . 340
28.5.3 DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
28.5.4 Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
28.5.5 Routing Daemons . . . . . . . . . . . . . . . . . . . . . . 341
28.5.6 DHCP Daemons . . . . . . . . . . . . . . . . . . . . . . . 341
28.5.7 IPsec with ISAKMP . . . . . . . . . . . . . . . . . . . . . 341
28.5.8 Kerberos V . . . . . . . . . . . . . . . . . . . . . . . . . . 341
28.6 Programming with IPv6 . . . . . . . . . . . . . . . . . . . . . . . 342
28.7 IPv6 and Security . . . . . . . . . . . . . . . . . . . . . . . . . . 342
28.7.1 Firewalling IPv6 with pf . . . . . . . . . . . . . . . . . . 342
28.8 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
28.9 Troubleshooting IPv6 . . . . . . . . . . . . . . . . . . . . . . . . 343
29 Systrace 345
29.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
29.1.1 Example Use . . . . . . . . . . . . . . . . . . . . . . . . . 347
29.2 Creating Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
29.2.1 Editing Policies . . . . . . . . . . . . . . . . . . . . . . . . 349
29.2.2 The Benefit of a Local Caching Nameserver . . . . . . . . 350
29.3 Privilege Elevation with Systrace . . . . . . . . . . . . . . . . . . 351
29.4 Where to Use Systrace . . . . . . . . . . . . . . . . . . . . . . . . 351
29.5 System Coverage with Systrace . . . . . . . . . . . . . . . . . . . 352
29.6 Additional Uses for Systrace . . . . . . . . . . . . . . . . . . . . . 352
29.6.1 Software Testing . . . . . . . . . . . . . . . . . . . . . . . 352
29.6.2 IDS Logging . . . . . . . . . . . . . . . . . . . . . . . . . 353
29.7 Limitations of Systrace . . . . . . . . . . . . . . . . . . . . . . . . 353
29.8 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
30 Network Intrusion Detection 355
30.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
30.2 Snort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
30.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 356
30.2.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 358
30.2.3 Loading New Rules . . . . . . . . . . . . . . . . . . . . . . 358
30.2.4 Snort Add-Ons . . . . . . . . . . . . . . . . . . . . . . . . 359
30.2.5 Integration with PF . . . . . . . . . . . . . . . . . . . . . 359
30.3 Other IDS Solutions . . . . . . . . . . . . . . . . . . . . . . . . . 360
30.4 Important Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
30.5 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
31.1 Upgrading an Installation . . . . . . . . . . . . . . . . . . . . . . 361
31.2 CVS and Branches . . . . . . . . . . . . . . . . . . . . . . . . . . 361
31.3 System Preparation . . . . . . . . . . . . . . . . . . . . . . . . . 362
31.4 Upgrading from Binary Sets . . . . . . . . . . . . . . . . . . . . . 362
31.5 Upgrading from Source . . . . . . . . . . . . . . . . . . . . . . . . 363
31.6 Upgrading Configuration Files . . . . . . . . . . . . . . . . . . . . 364
31.6.1 Using Mergemaster to Help . . . . . . . . . . . . . . . . . 365
31.6.2 Merging by Hand . . . . . . . . . . . . . . . . . . . . . . . 366
31.7 Binary Format Changes and Upgrades . . . . . . . . . . . . . . . 367
32 Kernel Compilation 369
32.1 Why recompile a kernel? . . . . . . . . . . . . . . . . . . . . . . . 369
32.1.1 Why not reconfigure and rebuild your kernel . . . . . . . 370
32.2 Where to get the source and how to compile . . . . . . . . . . . . 370
32.3 Information to be set in the configuration files . . . . . . . . . . . 371
32.4 Tweaking a built kernel . . . . . . . . . . . . . . . . . . . . . . . 373
32.5 Kernel-Userland Sync . . . . . . . . . . . . . . . . . . . . . . . . 374
33 Bug Reports with OpenBSD 375
33.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
33.2 Diagnosing a Problem . . . . . . . . . . . . . . . . . . . . . . . . 376
33.3 Check With Others . . . . . . . . . . . . . . . . . . . . . . . . . . 376
33.4 Develop a Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 377
33.5 The OpenBSD Bug Tracking System . . . . . . . . . . . . . . . . 378
33.6 Reporting Bugs with sendbug . . . . . . . . . . . . . . . . . . . . 379
IV Appendix 381
A CVS Basics 383
A.1 How to Set Yourself Up for CVS . . . . . . . . . . . . . . . . . . 383
A.1.1 CVS and the pserver . . . . . . . . . . . . . . . . . . . . . 384
A.2 Actually Using CVS . . . . . . . . . . . . . . . . . . . . . . . . . 385
A.3 CVS and Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
A.4 Speeding Up CVS . . . . . . . . . . . . . . . . . . . . . . . . . . 387
A.4.1 Chosing a Mirror . . . . . . . . . . . . . . . . . . . . . . . 387
A.4.2 Compression . . . . . . . . . . . . . . . . . . . . . . . . . 387
A.4.3 Ignoring Parts of the Tree . . . . . . . . . . . . . . . . . . 387
A.5 Selected References . . . . . . . . . . . . . . . . . . . . . . . . . . 388
B Applying Source Code Patches 389
B.1 What Patches Are . . . . . . . . . . . . . . . . . . . . . . . . . . 389
B.2 The Structure of a Patch . . . . . . . . . . . . . . . . . . . . . . 389
B.3 Using the Patch Tool . . . . . . . . . . . . . . . . . . . . . . . . . 390
B.4 Obtaining Patches for OpenBSD . . . . . . . . . . . . . . . . . . 391
C.1 What are Tunable Parameters . . . . . . . . . . . . . . . . . . . . 393
C.2 Using sysctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
C.2.1 Reading Variables . . . . . . . . . . . . . . . . . . . . . . 394
C.2.2 Writing to Variables . . . . . . . . . . . . . . . . . . . . . 394
C.3 The variable heirarchy . . . . . . . . . . . . . . . . . . . . . . . . 395
C.4 Filesystem Improvements . . . . . . . . . . . . . . . . . . . . . . 395
D A dmesg walk through 397
D.1 What Does dmesg Give Us? . . . . . . . . . . . . . . . . . . . . . 397
D.2 What the messages mean . . . . . . . . . . . . . . . . . . . . . . 398
D.2.1 The Boot Messages . . . . . . . . . . . . . . . . . . . . . . 398
E Core File Evaluation 401
E.1 Applications That Crashed . . . . . . . . . . . . . . . . . . . . . 401
E.2 Kernel Crash Dump Analysis . . . . . . . . . . . . . . . . . . . . 403
E.2.1 Using DDB . . . . . . . . . . . . . . . . . . . . . . . . . . 403
E.2.2 Post Reboot Analysis . . . . . . . . . . . . . . . . . . . . 404
E.2.3 Examining the Process Table . . . . . . . . . . . . . . . . 404
F Other OpenBSD Tools and Resources 407
F.1 Web Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
F.2 Software Mirrors . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
F.2.1 BSD Specific Software . . . . . . . . . . . . . . . . . . . . 408
F.2.2 Generic Software Sites . . . . . . . . . . . . . . . . . . . . 408
F.3 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
F.4 User Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
F.5 News Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
F.6 RFC Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
G IPsec m4 413
G.1 lib.m4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413




Library of Congress Subject Headings for this publication: OpenBSD (Electronic resource)Operating systems (Computers)Computer security, Computer architecture