SECOND EDITION NETWORK SECURITY HACKS 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Andrew Lockhart O'REILLY Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo
Contents Credits Preface xi xv Chapter 1. Unix Host Security 1 1. Secure Mount Points 2 2. Scan for SUID and SGID Programs 3 3. Scan for World- and Group-Writable Directories 5 4. Create Flexible Permissions Hierarchies with POSIX ACLs 5 5. Protect Your Logs from Tampering 9 6. Delegate Administrative Roles 11 7. Automate Cryptographic Signature Verification 13 8. Check for Listening Services 15 9. Prevent Services from Binding to an Interface 17 10. Restrict Services with Sandboxed Environments 19 11. Use proftpd with a MySQL Authentication Source 23 12. Prevent Stack-Smashing Attacks 26 13. Lock Down Your Kernel with grsecurity 28 14. Restrict Applications with grsecurity 33 15. Restrict System Calls with systrace 36 16. Create systrace Policies Automatically 39 17. Control Login Access with PAM 41 18. Restrict Users to SCP and SFTP 46 19. Use Single-Use Passwords for Authentication 49 20. Restrict Shell Environments 52
21. Enforce User and Group Resource Limits 22. Automate System Updates Chapter 2. Windows Host Security 23. Check Servers for Applied Patches 24. Use Group Policy to Configure Automatic Updates 25. List Open Files and Their Owning Processes 26. List Running Services and Open Ports 27. Enable Auditing 28. Enumerate Automatically Executed Programs 29. Secure Your Event Logs 30. Change Your Maximum Log File Sizes 31. Back Up and Clear the Event Logs 32. Disable Default Shares 33. Encrypt Your Temp Folder 34. Back Up EFS 35. Clear the Paging File at Shutdown 36. Check for Passwords That Never Expire Chapter 3. Privacy and Anonymity 37. Evade Traffic Analysis 38. Tunnel SSH Through Tor 39. Encrypt Your Files Seamlessly 40. Guard Against Phishing 41. Use the Web with Fewer Passwords 42. Encrypt Your Email with Thunderbird 43. Encrypt Your Email in Mac OS X Chapter 4. Firewaiiing 44. Firewall with Netfilter 45. Firewall with OpenBSD's PacketFilter 46. Protect Your Computer with the Windows Firewall 47. Close Down Open Ports and Block Protocols 48. Replace the Windows Firewall 49. Create an Authenticated Gateway 50. Keep Your Network Self-Contained 54 55 58 59 63 66 68 69 71 73 73 75 78 79 80 86. 91 91 95 96 100 105 107 112 117 117 122 128 137 139 147 149 VI Contents
51. Test Your Firewall 151 52. MAC Filter with Netfilter 154 53. Block Tor 156 Chapter 5. Encrypting and Securing Services 158 54. Encrypt IMAP and POP with SSL 158 55. Use TLS-Enabled SMTP with Sendmail 161 56. Use TLS-Enabled SMTP with Qmail 163 57. Install Apache with SSL and suexec 164 58. Secure BIND 169 59. Set Up a Minimal and Secure DNS Server 172 60. Secure MySQL 176 61. Share Files Securely in Unix 178 Chapter 6. Network Security 183 62. Detect ARP Spoofing 184 63. Create a Static ARP Table 186 64. Protect Against SSH Brute-Force Attacks 188 65. Fool Remote Operating System Detection Software 190 66. Keep an Inventory of Your Network 194 67. Scan Your Network for Vulnerabilities 197 68. Keep Server Clocks Synchronized 207 69. Create Your Own Certificate Authority 209 70. Distribute Your CA to Clients 213 71. Back Up and Restore a Certificate Authority with Certificate Services 214 72. Detect Ethernet Sniffers Remotely 221 73. Help Track Attackers 227 74. Scan for Viruses on Your Unix Servers 229 75. Track Vulnerabilities 233 Chapter 7. Wireless Security 236 76. Turn Your Commodity Wireless Routers into a Sophisticated Security Platform 236 77. Use Fine-Grained Authentication for Your Wireless Network 240 78. Deploy a Captive Portal 244 Contents I vii
Chapter 8. Logging 79. Run a Central Syslog Server 80. Steer Syslog 81. Integrate Windows into Your Syslog Infrastructure 82. Summarize Your Logs Automatically 83. Monitor Your Logs Automatically 84. Aggregate Logs from Remote Sites 85. Log User Activity with Process Accounting 86. Centrally Monitor the Security Posture of Your Servers Chapter 9. Monitoring and Trending 87. Monitor Availability 88. Graph Trends 89. Get Real-Time Network Stats 90. Collect Statistics with Firewall Rules 91. Sniff the Ether Remotely Chapter 10. Secure Tunnels 92. Set Up IPsec Under Linux 93. Set Up IPsec Under FreeBSD 94. Set Up IPsec in OpenBSD 95. Encrypt Traffic Automatically with Openswan 96. Forward and Encrypt Traffic with SSH 97. Automate Logins with SSH Client Keys 98. Use a Squid Proxy over SSH 99. Use SSH As a SOCKS Proxy 100. Encrypt and Tunnel Traffic with SSL 101. Tunnel Connections Inside HTTP 102. Tunnel with VTun and SSH 103. Generate VTun Configurations Automatically 104. Create a Cross-Platform VPN 105. Tunnel PPP 250 251 252 254 262 263 266 272 273 282 283 291 293 295 297 301 301 306 309 314 316 318 320 322 324 327 329 334 339 345 viii I Contents