Configuring a System Properly
1 Overview
1.1 Abstract
- As many as a billion nodes connected to the Internet are personal
machines running Windows and Linux, with little supervision from
system administrators. These have become targets of script kiddies.
- This lecture and the associated lab experiment are intended to help
configure personal systems running Linux.
- We focus on the security of Linux systems. We only highlight what
needs to be done leaving out the recipe-level descriptions to the
references.
- There are two other lectures related to the current lecture:
Fortification and Hardening.
1.2 Abstract #2
- Systems as distributed and installed "out-of-the-box" are often
loosely configured. This may be due to sloppiness of the
distributor. More commonly it is because the distributor has tried
to configure a generic appeal-to-all setup. Proper configuration
involves the examination of configuration settings of all installed
software. This is a prerequisite to fortifying and/or hardening.
- Proper configuration should happen immediately after a fresh
install of the OS, and then after making changes to the system
including adding or deleting services and user accounts. It should
be done on the host machine without network connections. We ignore
here the considerable amount of configuration tuning done to
improve performance, reduce resource usage, and in general for
cleanup.
- The Internet Domain Survey ( https://www.isc.org/network/survey/)
reports the number of hosts advertised in the DNS. As of Jul 2017
it is 1 billion. Perhaps as many as 95% of these are personal
machines, the rest being various servers. Perhaps 80% of these
personal machines, and nearly 100% of those behind firewalls in
private LANs, are running Windows 10 and Linux with little
supervision from trained system administrators, the remaining
systems being other variants of Unix and Macintoshes. These have
become targets of script kiddies.
1.3 Educational Objectives
- Recognize that out of the box installations of OS are
insecure.
- Know the typical problem spots.
- Identify unneeded services
2 Booting Sequence
- Booting time is an excellent point where an attacker can install
Trojans. Examine the booting sequence to verify that the kernel
and other executables are what they claim to be. = =Also,
compare the MD5 sums of the executables after each boot with those
you saved immediately after fresh install.
- Reviewing inittab and Boot Scripts
- Disabling Unneeded Services: See below.
- Configuring Services
- Closing Network Ports and Disabling Runlevel System Services
- Closing Network Ports and Disabling Xinetd Services
3 Files and Installed Software
- Installing a new OS image has become a straightforward
activity. Nearly all well-known Linux distributions and Windows can
be installed by non-computer specialist by booting from a supplied
DVD and answering a few questions. This activity is not the focus of
this lecture. In the lab experiment, we have simplified the install
problem further. There is a so-called "frugal install" which leaves
most of a Linux distribution installed as a single large (in the GB)
file that is an image of a compressed file system. There is some
performance loss as a result, but there is also greater assurance
that the files within remain intact.
- The rest of the lecture highlights checks you should make after
this initial phase of installing a new OS image, and associated
applications. Depending on the distribution, the path names cited
below may be different.
- Checking File Permissions and Ownership. Examine all the files in
the standard directories:
/, /bin, /boot, /dev, /etc, /root
,
/sbin, /usr, /usr/bin,
and /usr/sbin.
These should
all be owned by root and not writeable to others. The
/tmp
and </var/tmp> are world-writeable. The file
/etc/passwd
is world-readable for legacy reasons, but
/etc/shadow
should be world-unreadable.
- SUID executables: Examine every suid root file.
find / -type f \( -perm
-004000 -o -perm -002000 \) -exec ls -lg {} \;
will list all
the SUID/SGID files. Verify that every such binary or script needs
to be set-user-id-ed. Setuid scripts are very vulnerable. If POSIX
capabilities are enabled, suid root permission can be removed.
- Securing Postfix, Sendmail, … . Do we need these?
- Securing NFS and samba.
- Securing SSH. Copying Files Using SSH Without Providing Login Prompts
4 User Accounts and Passwords
4.1 Strong Password Policy
- Use tools such as "John the ripper" to find out weak users
passwords on your server. Configure
pam_cracklib.so
to enforce
the password policy.
- Linux: Force Users To Change Their Passwords Upon First Login
- Linux turn On / Off password expiration / aging
- Search for all account without password and lock them
- Use Linux groups to enhance security
- Under Linux you can use the faillog command to display faillog
records or to set login failure limits. faillog formats the
contents of the failure log from /var/log/faillog database / log
file. It also can be used for maintains failure counters and
limits.
- Only root account have UID 0 with full permissions to access the
system.
- Enable Password Aging. Restrict Use of Previous Passwords. Lock
User Accounts After Too Many Login Failures.
- Restricting Direct Login Access for System and Shared Accounts
- Restricting
su
Access to System and Shared Accounts
5 Shutdown Sequence
- Shutdown time also is an excellent point where an attacker can
install Trojans. A clever attacker would have downloaded the
needed files during the normal running, but would not have
installed them until most of the system was shut down.
7 References
- https://wiki.ubuntu.com/BasicSecurity Required Reading.
- http://bastille-linux.sourceforge.net/ Bastille "… locks down an
operating system, proactively configuring the system for increased
security and decreasing its susceptibility to compromise. …
Bastille currently supports the Red Hat, …, Debian
… distributions, …. It also supports Mac OS X. … In its
assessment mode, it builds a report intended to teach the user
about available security settings … ." Bastille should use the
term "proper configuration" instead of
"hardening". 201x. Not actively being developed. Good
choice for CEG6420 extra lab work. Highly Recommended Reading.
- http://cisecurity.org/ Center for Internet Security,
Security Configuration Benchmarks: Microsoft Windows 7
Benchmarks, 2012. "The CIS Benchmarks are the only
consensus-based, best-practice security configuration guides both
developed and accepted by government, business, industry, and
academia." Highly Recommended Reading.
- http://www.debian.org/doc/manuals/securing-debian-howto/
securing-debian-howto. "… Starting with the process of
securing and hardening the default Debian GNU/Linux
… installation, … gives additional information on the
security tools available …". Required visit.
- NIST, http://usgcb.nist.gov/ United States Government Configuration
Baseline, 2012. "The purpose of the United States Government
Configuration Baseline (USGCB) initiative is to create security
configuration baselines for Information Technology products widely
deployed across the federal agencies. Formal definitions of these
baseline settings, … supporting reference material for
implementing and verifying USGCB settings on target systems.
… available for Windows 7, …, Windows XP, Internet Explorer
…" Highly Recommended Reading.
- NIST, http://nvd.nist.gov/ National Vulnerability
Database, 2017. "NVD contains content (and pointers to tools)
for performing configuration checking of systems implementing the
Federal Desktop Core Configuration (FDCC) using the Security
Content Automation Protocol (SCAP)." Highly Recommended Reading.
- Ubuntu,
https://wiki.ubuntu.com/Security/Features. Even though Ubuntu
specific, there is much to learn here. Required Reading.
- https://resources.sei.cmu.edu/asset_files/WhitePaper/2006_019_001_496737.pdf
UNIX Configuration Guidelines 2017
Copyright © 2018
www.wright.edu/~pmateti • 2018-09-10