The rise of shadow passwords and MD5 could potentially cause over-diversification, with every combination of add-ons requiring its own versions of commands like passwd or login. This problem is avoided by the Pluggable Authentication Method (PAM). PAM can be thought of as an intermediary between the commands and processes involved with authentication and any modifications to it. PAM evolved along with shadow passwords and MD5 and has been available in distributions since about 1997.
Originally, PAM was configured in /etc/pam.conf. However, in most distributions, this file is now as vestigial as an appendix. Instead, PAM uses the /etc/pam.d directory.
A handful of files in /etc/pam.d define which users or groups, if any, can use a specific command. For example, /etc/pam.d/su regulates the su command. Other limits may be set in /etc/security/limits.conf. However, the majority of the files in /etc/pam.d act as intermediaries between password system enhancements and other commands, pointing to libraries in /lib/security. Examples of these files include chfn, chsh, cron, gdm and login. This function allows not only the use of shadow passwords or MD5 but eases the addition of upscale security solutions such as Kerebos.
The files in /etc/pam.d offer far too many options to detail here. However, the files are heavily commented and relatively easy to follow. Files such as passwd, gdm, login and su, which control the basics of the password system, are especially useful. For example, login can control root logins, put a time restraint on logins and set how login attempts are logged. Similarly, if you use su on the system, rather than the more controllable sudo, /etc/pam.d/su can help you set limits on how the command is used. And, while you don't want to change the references to security libraries in the pam.d files, you might want to look at the options used with them—for instance, the security-minded might want to avoid nullok, which allows users to change empty passwords. Going farther afield, chsh can be used to limit the shells users can use to a list in /etc/shells. In short, while browsing the pam.d directory can leave you with the trauma of option anxiety, you'll find the effort an important step in learning how to make your system more secure.
Shadow passwords, MD5 and PAM all increase the security of a system. However, keep in mind that the security they provide is relative. Given enough computing power and enough time, a brute-force attack can crack any system.
Moreover, the effort is getting easier with each advance in hardware and crackers' tools. To put things in perspective, in 1994, RSA Security system estimated that a brute-force attack on the average machine would succeed within 24 days. By contrast, the developers of mdcrack, a tool that can be used for testing the security of MD5-enabled systems, claim that a 56-character password can be cracked on an average machine using the 2.2 Linux kernel within 20 seconds. Although that was almost twice as long as the average time to crack a Windows machine, obviously Linux users have no reason to be smug. And the situation is only going to get worse.
One way to respond to this pressure is to make better use of the password system. Many users, especially at home, forget about the password system after they install and fail to use anything except its most basic features. Yet a little attention to detail could be enough to send the script kiddies into tantrums. For example:
Set the number of days that a password can be used in /etc/shadow. The method is a pain, but regularly changed passwords could set back a brute-force attack that relies more on time than computing power.
Increase the minimum and maximum password lengths in /etc/pam.d/passwd. Other things being equal: the longer the password, the longer it takes to crack.
Lower the minimum number of login attempts in /etc/pam.d/gdm. Legitimate users with sausage-like fingers might complain, but anyone attempting a brute-force attack could be irritated enough to go away.
Approve all user passwords or insist that they are generated by a program like pwgen that creates secure passwords. The number of users whose password is “password” or the name of their youngest daughter or goldfish is too depressing for words.
Install a program like cracklib2, which prevents the use of easily guessed passwords. You'll probably want to add a custom dictionary of company, product and user names that cannot be used as passwords. Currently, cracklib2 requires some patience to set up, as well as the uncommenting of a number of lines in /etc/pam.d, but it, or a similar package, is likely to become a standard part of major distributions in the next few years.
Do not allow the root user to log in remotely.
Watch for expired passwords or user accounts without passwords. Either could be an entry point to the system.
Turn off your computer or your net connection if you're not using it. Forget the geek macho about how long your system has been running. If it's not connected, then remote cracks can't happen.
Another response to the increased risks of modern computers is the increased use of password authentication on the system. Here are some of the places you can add passwords if they aren't already there:
The BIOS: use a password and make sure it can't be bypassed via floppy or CD.
The Boot Manager: use LILO's password command or GRUB's lock command.
Remote Services: ssh sends encrypted passwords—Telnet and FTP don't. Guess which one you should use?
Still, there's no reason not to use whatever security passwords afford. And there's definitely not a reason to bypass the password system or weaken it—two options that are starting to appear in modern distributions in the hopes of making GNU/Linux seem more like other operating systems of the average user's acquaintance. The tools are there, so why not use them?
-- Bruce Byfield (nanday)
Webinar: 8 Signs You’re Beyond Cron
11am CDT, April 29th
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.Join us!
|Play for Me, Jarvis||Apr 16, 2015|
|Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites||Apr 15, 2015|
|Non-Linux FOSS: .NET?||Apr 13, 2015|
|Designing Foils with XFLR5||Apr 08, 2015|
|diff -u: What's New in Kernel Development||Apr 07, 2015|
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Play for Me, Jarvis
- Non-Linux FOSS: .NET?
- Designing Foils with XFLR5
- Not So Dynamic Updates
- Flexible Access Control with Squid Proxy
- New Products
- New GeekGuide: Beyond Cron
- Users, Permissions and Multitenant Sites