Linux Security
Linux Security
Linux Security
OpenSSH uses public key cryptography to provide secure authorization. # htpasswd -cm /etc/httpd/conf/private-users user1
# Send a copy to remote loghost. Configure syslogd init
• Configure BIND to run as a normal user. Once BIND has been started, it has the ability
Generating the public key, which is shared with remote systems, and the private New password: <password> to relinquish its privileges, and run as a user with limited abilities instead of root.
# script to run with -r -s domain.com options on log
key which is kept on the local system, is done first to configure OpenSSH. Re-type new password: <password>
# server. Ensure a high level of security on the log # useradd -M -r -d /var/named -s /bin/false named
Adding password for user user1
orion$ ssh-keygen # server! # groupadd -r named
Generating RSA keys: ...ooooooO....ooooooO Be sure to restart apache and test it. This will result in the enabling of double *.info @loghost
Key generation complete.
auth.*;authpriv.* @loghost This account should be used for nothing other than running the name server. Ensure the
Enter file in which to save the key (/home/dave/.ssh/identity): reverse lookups to verify the identity of the remote host. Remove the -c
zone files are readable by the named user. It is then necessary to modify the default
Created directory '/home/dave/.ssh'. option to htpasswd after the first user has been added. Be sure the password
• Restrict access to log directory and syslog files for normal users using: named init script, typically found in /etc/rc.d/init.d/named on Red Hat or
Enter passphrase (empty for no passphrase): <passphrase> file you create is not located within the DocumentRoot to prevent it from
Enter same passphrase again: <passphrase> /etc/init.d/named on Debian:
being downloaded. # chmod 751 /var/log /etc/logrotate.d
Your identification has been saved in /home/dave/.ssh/identity.
Your public key has been saved in /home/dave/.ssh/identity.pub. # chmod 640 /etc/syslog.conf /etc/logrotate.conf /usr/sbin/named -u named -g named
The key fingerprint is: Configuring TCP Wrappers: # chmod 640 /var/log/*log
ac:42:11:c8:0d:b6:7e:b4:06:6a:a3:a7:e8:2c:b0:12 dave@orion It is also possible to run named in a “chroot jail” which helps to restrict the damage that
Frequently used to monitor and control access to services listed in can be done should named be subverted.
• Copy Public Key to Remote Host: /etc/inetd.conf. The in.ftpd service might be wrapped using:
Install and Configure Tripwire:
host2$ mkdir -m 700 ~dave/.ssh Tripwire is a program that monitors file integrity by maintaining a database of
Critical System Files:
host2$ cp /mnt/floppy/identity.pub ~dave/.ssh/authorized_keys ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -L -i -o
cryptographic signatures for programs and configuration files installed on the
File/Directory Perms Description
• Log in to Remote Host: system, and reports changes in any of these files.
Before the in.telnetd daemon is spawned, tcpd first determines if the /var/log 751 Directory containing all log files
source is a permitted host. Connection attempts are sent to syslogd. All A database of checksums and other characteristics for the files listed in the /var/log/messages 644 System messages
The SSH client (/usr/bin/ssh) is a drop-in replacement for rlogin and rsh. It services should be disabled by default in /etc/hosts.deny using the configuration file is created. Each subsequent run compares any differences to /etc/crontab 600 System-wide crontab file
can be used to securely login to a remote host: following: the reference database, and the administrator is notified. /etc/syslog.conf 640 Syslog daemon configuration file
ALL: ALL /etc/logrotate.conf 640 Controls rotating of system log files
orion$ ssh host2 The greatest level of assurance that can be provided occurs if Tripwire is run /var/log/wtmp 660 Who is logged in now. Use who to view
Enter passphrase for RSA key 'dave@orion': <passphrase> To send an email to the admin and report failed connection attempt: immediately after Linux has been installed and security updates applied, and /var/log/lastlog 640 Who has logged in before. Use last to view
Last login: Sat Aug 15 17:13:01 2000 from orion before it is connected to a network.
ALL: ALL: /bin/mail \ /etc/ftpusers 600 List of users that cannot FTP
No mail.
-s “%s connection attempt from %c” admin@mydom.com /etc/passwd 644 List of the system’s user accounts
host2$ A text configuration file, called a policy file, is used to define the characteristics for
/etc/shadow 600 Contains encrypted account passwords
each file that are tracked. Your level of paranoia determines the frequency in
Enable specific services in /etc/hosts.allow using the service name /etc/pam.d 750 PAM configuration files
• Copy Files to Remote Host: which the integrity of the files are checked. Administration requires constant
followed by the host: /etc/hosts.allow 600 Access control file
attention to the system changes, and can be time-consuming if used for many
The OpenSSH package also includes scp, a secure and improved replacement for sshd: magneto.mydom.com, juggernaut.mydom.com /etc/hosts.deny 600 Access control file
systems. Available in unsupported commercial binary for Red Hat and similar.
rcp. This allows you to securely copy files over a network. in.ftpd: 192.168.1. /etc/lilo.conf 600 Boot loader configuration file
# Create policy file from text file /etc/securetty 600 TTY interfaces that allow root logins
orion$ scp /tmp/file.tar.gz host2:/tmp Trailing period indicates entire network should be permitted. Use tcpdchk to /usr/TSS/bin/twadmin -m P policy.txt /etc/shutdown.allow 400 Users permitted to ctrl-alt-del
Enter passphrase for RSA key 'dave@orion: verify your access files. A syslog entry will be created for failed attempts. # Initialize database according to policy file /etc/security 700 System access security policy files
file.tar.gz 100% |***************************| 98304 00:00 Access control is performed in the following order: /usr/TSS/bin/tripwire —init /etc/rc.d/init.d 750 Program start-up files on Red Hat systems
It is also possible to encapsulate ordinarily insecure protocols such as IMAP and • Access will be granted when a daemon/client pair matches an entry in # Print database
/etc/init.d 750 Program start-up files on Debian systems
POP within SSH to prevent transmitting clear text passwords to your mail server. the /etc/hosts.allow file. /usr/TSS/bin/twprint -m d /etc/sysconfig 751 System and network config files on Red Hat
Additionally, the rsync incremental file transfer utility can use SSH to securely • Otherwise, access will be denied when a daemon/client pair matches /etc/inetd.conf 600 Internet SuperServer configuration file
synchronize two hosts, backup data to a log server securely, or even securely # Generate daily report file /etc/cron.allow 400 List of users permitted to use cron
an entry in the /etc/hosts.deny file. /usr/TSS/bin/tripwire -m c -t 1 -M
connect two subnets across the Internet, effectively creating a virtual private /etc/cron.deny 400 List of users denied access to cron
• Otherwise, access will be granted.
network. # Update database according to policy file and report file /etc/ssh 750 Secure Shell configuration files
A non-existing access control file is treated as if it were an empty file. Thus, /usr/TSS/bin/tripwire --update --polfile policy/tw.pol \ /etc/sysctl.conf 400 Contains kernel tunable options on recent Red Hat
© 2000 Guardian Digital, Inc. http://www.guardiandigital.com access control will be turned off if no access control files are present! --twrfile report/<hostname>-<date>.twr