Linux: Configuring and Securing Your Server Howto Guide
Total Page:16
File Type:pdf, Size:1020Kb
Linux: Configuring and securing your server howto guide A technical howto document presented to H3ABioNet Created by The System Administrator Task-force Prepared for The greater H3ABioNet and H3Africa Consortium community Document Control Date Author Authorization By Version Description 27 June 2014 Suresh System Administrator 1.0 First draft Maslamoney Task-force Contributors Last Name First Name Institution Country Alibi Mohamed Pasteur Institute of Tunis (IPT) Tunisia Brown David Rhodes University (RU) South Africa Indome David Noguchi Memorial Institute for Medical Research Ghana (NMIMR) Scheepers Inus Centre for High Performance Computing (CHPC) South Africa Maslamoney Suresh Computational Biology Group – UCT (CBIO) South Africa Panji Sumir Computational Biology Group – UCT (CBIO) South Africa Van Heusden Peter South African National Bioinformatics (SANBI) South Africa Marcello Lucio (CIDRES) Burkina Faso Reviewers Last Name First Name Institution Country HowTo: Linux Server Management and Configuration Guide Page 2 of 33 Acronyms and Abbreviations Acronym and Abbreviations Description CLI The Command Line Interface refers to the actual local terminal on the Linux server used to navigate, configure and manage the system NIC A Network Interface Card is a physical network card installed the physical server OS A Operating System is a piece of software which is installed on a computer system and manages communication between the physical hardware and user based applications SL Scientific Linux Operating System HowTo: Linux Server Management and Configuration Guide Page 3 of 33 Table of Contents Document Control................................................................................................................................... 2 Contributors ............................................................................................................................................ 2 Reviewers ................................................................................................................................................ 2 Acronyms and Abbreviations .................................................................................................................. 3 Introduction ............................................................................................................................................ 6 Support Contact Information .................................................................................................................. 6 Overview ................................................................................................................................................. 7 1. Network Interface Card (NIC) Configuration .................................................................................. 7 2. Software repositories ...................................................................................................................... 9 2.1. Package manager ................................................................................................................. 11 3. User Accounts ............................................................................................................................... 12 3.1. Creating general user accounts ....................................................................................... 12 3.2. Granting user accounts sudo rights ................................................................................ 13 4. Services ......................................................................................................................................... 13 5. Securing your local server: The basics .......................................................................................... 14 5.1. Install and configure a Linux firewall ................................................................................... 15 5.1.1. To install ufw from the CLI .............................................................................................. 15 5.1.2. iptables ............................................................................................................................ 15 5.2. Secure shell (SSH) ................................................................................................................ 16 5.2.1. How Does SSH Work? ...................................................................................................... 16 5.2.2. How to configure SSH ...................................................................................................... 17 5.2.3. How to log into SSH with keys ......................................................................................... 18 5.2.4. How to create SSH keys ................................................................................................... 18 5.2.5. How To Transfer Your Public Key to the Server .............................................................. 19 5.3. Server hardening (SELinux and AppArmor) ......................................................................... 20 AppArmor ...................................................................................................................................... 20 SELinux .......................................................................................................................................... 20 5.4. Nmap - Scanning the local machine or network ................................................................. 21 5.4.1. Installing nmap ................................................................................................................ 21 5.4.2. Basic nmap usage commands ............................................................................................. 22 5.5. Log Files ............................................................................................................................... 22 5.5.1. LogWatch ........................................................................................................................ 23 5.5.2. Deny Hosts ...................................................................................................................... 24 HowTo: Linux Server Management and Configuration Guide Page 4 of 33 5.5.3. Fail2ban ........................................................................................................................... 25 5.6. Audit your system security .................................................................................................. 26 6. Data Encryption............................................................................................................................. 27 6.1. GnuPG .................................................................................................................................. 28 6.2. Crypt .................................................................................................................................... 30 6.3. 7-Zip ..................................................................................................................................... 31 7. Software application and OS updates ........................................................................................... 32 8. References .................................................................................................................................... 33 HowTo: Linux Server Management and Configuration Guide Page 5 of 33 Introduction This document was developed by the H3ABioNet system administrator task force and is focused specifically on H3ABioNet system administrators who do not have Linux specific skills. In the level one documentation we looked at how to configure RAID on your hard drives and how to install the three officially supported Linux distributions. In this document we concentrate on configuring and securing your local server Support Contact Information Table 1 below lists all the support contact details for the C6145 server. Both groups of support personnel will provide both hardware and software support to H3ABioNet consortium members. The H3ABioNet helpdesk will however provide additional bioinformatics support. Table 1 Vendor Contact Number Contact Description Person H3ABioNet [email protected] Helpdesk Log all calls via the H3AbioNet Helpdesk helpdesk and a support specialist will be assigned to your call HowTo: Linux Server Management and Configuration Guide Page 6 of 33 Overview This howto document sets out to provide tips, best practices and step by step instructions for configuring and securing your server. The level 2 series of howto guides starts with this document and branches out to additional howto guides such as installing and using a HPC cluster and Globus Online application for transferring data between nodes. This document begins with the configuration of your network cards. Once your operating system is installed, your next step is to configure the network cards. This step is important as it makes your server accessible via the network. 1. Network Interface Card (NIC) Configuration For a computer system to work on a network it requires an IP address. The server can be configured to us a static IP address or one assigned by a DHCP server. The below instruction will provide step by step instruction to configure your network interface cards to use either a statically assigned IP address or one automatically assigned by a DHCP server. Setting up of a DHCP server is beyond the scope of this howto and as such will not be discussed. NOTE: 1. Network