"You have in your hands a book I've been waiting to read for yearsa practical, hands-on guide to hardening your Linux system."
From the foreword by Eric S. Raymond
"A comprehensive guide to system security: covers everything from hardening a system to system recovery after an attack."
Steve Bourne, Creator of the Bourne Shell
Stop today's most vicious Internet attackersright in their tracks!
Your Linux system will be attacked: maybe in minutes, certainly in days. Be ready! Real World Linux Security, Second Edition brings together state-of-the-art solutions and exclusive software for safeguarding any Linux-based system or network, and fighting off any intrusion. Top Linux security consultant Bob Toxen has thoroughly revamped this definitive guide to reflect today's most vicious Internet attacksand arm you with breakthrough resources for protecting yourself!
The accompanying web site contains the author's own state-of-the-art software for instantly locking out hackers and alerting system administrators. The website contents also include exclusive IP Tables and IP Chains firewall scripts (rule sets), as well as powerful new tools for monitoring network health, detecting and reporting suspicious activities, securing backups, simplifying recovery, and much more.
List of Figures.
List of Tables.
About the Author.
Introduction to the Second Edition. Who Should Read This Book? How This Book Is Organized. What Are You Protecting? Who Are Your Enemies? What They Hope to Accomplish. Costs: Protection versus Break-Ins. Protecting Hardware. Protecting Network and Modem Access. Protecting System Access. Protecting Files. Preparing for and Detecting an Intrusion. Recovering from an Intrusion.
I. SECURING YOUR SYSTEM.2. Quick Fixes for Common Problems.
Understanding Linux Security. The Seven Most Deadly Sins. Passwords: A Key Point for Good Security. Advanced Password Techniques. Protecting the System from User Mistakes. Forgiveness Is Better than Permission. Dangers and Countermeasures During Initial System Setup. Limiting Unreasonable Access. Firewalls and the Corporate Moat. Turn Off Unneeded Services. High Security Requires Minimum Services. Replace These Weak Doors with Brick. New Lamps for Old. United We Fall, Divided We Stand.3. Quick and Easy Hacking and How to Avoid It.
X Marks the Hole. Law of the Jungle—Physical Security. Physical Actions. Selected Short Subjects. Terminal Device Attacks. Disk Sniffing.4. Common Hacking by Subsystem.
NFS, mountd, and portmap. Sendmail. Telnet. FTP. The rsh, rcp, rexec, and rlogin Services. DNS (named, a.k.a. BIND). POP and IMAP Servers. Doing the Samba. Stop Squid from Inking Out Their Trail. The syslogd Service. The print Service (lpd). The ident Service. INND and News. Protecting Your DNS Registration.5. Common Hacker Attacks.
Rootkit Attacks (Script Kiddies). Packet Spoofing Explained. SYN Flood Attack Explained. Defeating SYN Flood Attacks. Defeating TCP Sequence Spoofing. Packet Storms, Smurf Attacks, and Fraggles. Buffer Overflows or Stamping on Memory with gets(). Spoofing Techniques. Man-in-the-Middle Attack.6. Advanced Security Issues.
Configuring Netscape for Higher Security. Stopping Access to I/O Devices. Scouting Out Apache (httpd) Problems. Special Techniques for Web Servers. One-Way Credit Card Data Path for Top Security. Hardening for Very High Security. Restricting Login Location and Times. Obscure but Deadly Problems. Defeating Login Simulators. Stopping Buffer Overflows with Libsafe.7. Establishing Security Policies.
General Policy. Personal Use Policy. Accounts Policy. E-Mail Policy. Instant Messenger (IM) Policy. Web Server Policy. File Server and Database Policy. Firewall Policy. Desktop Policy. Laptop Policy. Disposal Policy. Network Topology Policy. Problem Reporting Policy. Ownership Policy. Policy Policy.8. Trusting Other Computers.
Secure Systems and Insecure Systems. Trust No One—The Highest Security. Linux and UNIX Systems Within Your Control. Mainframes Within Your Control. A Window Is Worth a Thousand Cannons. Firewall Vulnerabilities. Virtual Private Networks. Viruses and Linux.9. Gutsy Break-Ins.
Mission Impossible Techniques. Spies. Fanatics and Suicide Attacks.10. Case Studies.
Confessions of a Berkeley System Mole. Knights of the Realm (Forensics). Ken Thompson Cracks the Navy. The Virtual Machine Trojan. AOL's DNS Change Fiasco. I'm Innocent, I Tell Ya! Cracking with a Laptop and a Pay Phone. Take a Few Cents off the Top. Nonprofit Organization Runs Out of Luck. Persistence with Recalcitrant SysAdmins Pays Off. Net Shipped with Nimda.11. Recent Break-Ins.
Fragmentation Attacks. IP Masquerading Fails for ICMP. The Ping of Death Sinks Dutch Shipping Company. Captain, We're Being Scanned! (Stealth Scans). Cable Modems: A Cracker's Dream. Using Sendmail to Block E-Mail Attacks. Sendmail Account Guessing. The Mysterious Ingreslock. You're Being Tracked. Distributed Denial of Service (Coordinated) Attacks. Stealth Trojan Horses. Linuxconf via TCP Port 98. Evil HTML Tags and Script. Format Problems with syslog().
II. PREPARING FOR AN INTRUSION.12. Hardening Your System.
Protecting User Sessions with SSH. Virtual Private Networks (VPNs). Pretty Good Privacy (PGP). Using GPG to Encrypt Files the Easy Way. Firewalls with IP Tables and DMZ. Firewalls with IP Chains and DMZ.13. Preparing Your Hardware.
Timing Is Everything. Advanced Preparation. Switch to Auxiliary Control (Hot Backups).14. Preparing Your Configuration.
TCP Wrappers. Adaptive Firewalls: Raising the Drawbridge with the Cracker Trap. Ending Cracker Servers with a Kernel Mod. Fire Drills. Break into Your Own System with Tiger Teams.15. Scanning Your Own System.
The Nessus Security Scanner. The SARA and SAINT Security Auditors. The nmap Network Mapper. The Snort Attack Detector. Scanning and Analyzing with SHADOW. John the Ripper. Store the RPM Database Checksums.
III. DETECTING AN INTRUSION.16. Monitoring Activity.
Log Files. Log Files: Measures and Countermeasures. Using Logcheck to Check Log Files You Never Check. Using PortSentry to Lock Out Hackers. HostSentry. Paging the SysAdmin: Cracking in Progress! An Example for Automatic Paging. Building on Your Example for Automatic Paging. Paging telnet and rsh Usage. Using Arpwatch to Catch ARP and MAC Attacks. Monitoring Port Usage. Monitoring Attacks with Ethereal. Using tcpdump to Monitor Your LAN. Monitoring the Scanners with Deception Tool Kit (DTK). Monitoring Processes. Cron: Watching the Crackers. Caller ID.17. Scanning Your System for Anomalies.
Finding Suspicious Files. Tripwire. Detecting Deleted Executables. Detecting Promiscuous Network Interface Cards. Finding Promiscuous Processes. Detecting Defaced Web Pages Automatically.
IV. RECOVERING FROM AN INTRUSION.18. Regaining Control of Your System.
Finding the Cracker's Running Processes. Handling Running Cracker Processes. Drop the Modems, Network, Printers, and System.19. Finding and Repairing the Damage.
Check Your /var/log Logs. The syslogd and klogd Daemons. Remote Logging. Interpreting Log File Entries. Check Other Logs. Check TCP Wrapper Responses. How the File System Can Be Damaged. Planting False Data. Altered Monitoring Programs. Stuck in the House of Mirrors. Getting Back in Control. Finding Cracker-Altered Files. Sealing the Crack. Finding set-UID Programs. Finding the mstream Trojan.20. Finding the Attacker's System.
Tracing a Numeric IP Address with nslookup. Tracing a Numeric IP Address with dig. Who's a Commie: Finding .com Owners. Finding Entities Directly from the IP Address. Finding a G-Man: Looking Up .gov Systems. Using ping. Using traceroute. Neighboring Systems' Results. A Recent International Tracking of a Cracker. Be Sure You Found the Attacker. Other SysAdmins: Do They Care?21. Having the Cracker Crack Rocks.
Police: Dragnet or Keystone Kops? Prosecution. Liability of ISPs Allowing Illegal Activity. Counteroffenses.Appendix A. Internet Resources for the Latest Intrusions and Defenses.
Mailing Lists: The Mandatory Ones. Mailing Lists: The Optional Ones. News Groups. URLs for Security Sites. URLs for Security Tools. URLs for Documentation. URLs for General Tools. URLs for Specifications and Definitions. Vendor Software and Updates. Other Software Updates.Appendix B. Books, CD-ROMs, and Videos.
Linux System Security. Building Linux and OpenBSD Firewalls. Samba: Integrating UNIX and Windows. Linux Sendmail Administration. Secrets and Lies: Digital Security in a Networked World. The Cuckoo's Egg. Hackers. UNIX Complete. The Computer Contradictionary. U.S. Department of Defense DISA Resource. Internetworking with TCP/IP Vols. I, II, and III Linux Application Development. Consultants: The Good, the Bad, and the Slick.Appendix C. Network Services and Ports.
Linux is a solid operating system. It is easy to use and install, has very powerful capabilities, runs fast on almost any hardware, and rarely crashes. It has few bugs and its widespread support from a cast of thousands ensures that any remaining bugs get fixed as soon as they are discovered. It is highly versatile and can be made as secure as any UNIX system.
Unfortunately, UNIX and Linux machines are broken into every day, not because they are inherently insecure, but because the steps required to expose a system to the real world safely—the modern Internet—are not always so obvious. The single goal of this book is to teach any Linux or UNIX system administrator how to secure his systems, keep them secure, and feel confident that all necessary steps have been taken.Introduction to the Second Edition
Much has happened in the two years since the first edition of Real World Linux Security was published and much that was anticipated has not come to pass. Rather than the anticipated upward-compatible version of IP Chains with additional features and security, we have IP Tables. Transitioning to IP Tables requires a major rewrite of any firewall script, and some features present in IP Chains under the Linux 2.2 kernel are absent from both IP Tables and IP Chains in the 2.4 kernel. IP Tables is addressed in this book in great detail, and I include some fascinating original research and firewall tips and techniques (see ""Firewalls with IP Tables and DMZ" on page 446). You will not find this information elsewhere.
The Internet has become a much more dangerous place. Two years ago an unhardened system stood a reasonable chance of not being compromised for months or even years. Now, an unsecured system probably will be broken into within a week or two, and a complete compromise within one day of being placed on the Web is common. With the popularity of always-on DSL and cable connections, the exposure to possible compromise is increased by a factor of 10, too. It is guaranteed that each system on the Internet gets scanned for various vulnerabilities on a daily basis now.
The cyber warfare of science fiction is now a fact! There is credible evidence that the Al Qaeda is preparing to commit damaging attacks against U.S. businesses and government. A number of countries' governments or individuals have staged massive cyber attacks against their enemies. With almost every Internet-connected computer handling credit card data, and crackers (sometimes called hackers) getting more vicious and more interested in financially profiting from their attacks, there is far more at risk.
In 2000 and later, there was much talk about the U.S. Federal Bureau of Investigation (FBI) getting more involved in solving computer crime, and there was much talk worldwide about more laws to reduce computer crime. In 2000, Microsoft promised to make great improvements in Windows security and again promised this in early 2002. I have seen none of this come to pass. While the big Linux vendors have made good on their promises to improve on security, they still have made big goofs in the security of even their latest offerings and even the "rock solid" Apache has not been immune from recent major vulnerabilities.
It is my opinion that even the viruses that have caused billions of dollars in damage due to lost files and wasted time are mild compared to what is possible. Viruses that can attack both Windows and Linux and viruses that can attack Linux and several flavors of UNIX have been demonstrated. As I write this, there are major security vulnerabilities in the current versions of Apache on Linux, UNIX, and Windows (the first in five years), as well as in Internet Explorer and Internet Information Services (IIS) running on most systems. It would not be especially difficult for a hacker to create a virus that attacks all of these platforms, sniffs these systems for credit card, bank account, and investment account numbers, and drains the accounts of money before anyone discovers it.
Real World Linux Security has undergone a major revision in the second edition. Problems that people did not worry about two years ago are now big concerns and have been addressed here. New technologies, such as wireless networks and IP Tables, have been addressed in depth. Hackers now are using more subtle attacks that were rare two years ago. These include attacking at the address resolution protocol (ARP) level. Even the lowly network switch now is being compromised with regularity. All of these situations are addressed.
Better methods for monitoring your network and instantly locking out attackers in this more vicious world are explained in step-by-step detail. Arpwatch, Logcheck, Portsentry, the newest versions of Samba and the GNU Privacy Guard (the GNU answer to Pretty Good Privacy PGP), the 2.4 kernel, Red Hat 7.3 and SuSE 8.0, VPNs, and greatly improved Adaptive Firewall techniques all are covered in depth in this book. About 150 pages of new material have been added, while appendices containing listings of programs on the CD-ROM and obsolete material have been removed or revised.Who Should Read This Book?
This book will aid Linux and UNIX System Administrators (SysAdmins) in making their systems and networks as secure as possible from intruders and improper action of the users. It covers both quick and simple solutions, and some more involved solutions to eliminate every possible vulnerability.
It is organized to allow the busy SysAdmin to increase the security of the systems one piece at a time. It is recognized that one cannot take a system down for a week and work exclusively on its security for that week. In the real world, a SysAdmin's time is divided up by many tasks that cannot wait and systems are too critical to stay down for long.
In the real world, some systems will be broken into despite the best efforts of talented SysAdmins. This book devotes over 60,000 words to dealing with a possible break-in. It deals with how to prepare for it, how to detect it, and how to recover from it quickly and completely with minimal loss of confidential data and money, with minimal inconvenience to one's customers and employees, and with minimal publicity. This is considered one of the unique features of this book.
On March 30, 2000, 350 "hackers" from around the world gathered in Israel for a conference. Organizers there said that they were able to break into 28 percent of Israeli computers that they tried and that this percentage was typical worldwide. This was with the permission of the computers' owners, who were convinced that their computers were invulnerable. The quoted statistics were not broken down by operating system type. Both John Draper ("Captain Crunch") and Kevin Mitnick were there.
The book is designed to be used by the veteran of many years of Linux and UNIX experience, as well as the new SysAdmin. It does assume that the reader is somewhat knowledgeable in system administration; Prentice Hall has other fine books to help people hone their SysAdmin skills. There are many useful details here, both for the person with a single Linux box at home and for those supporting multinational corporations and large government agencies with very large networks comprised of multiple types of operating systems.