MASTERING_CENTOS_7_LINUX_SERVER Preface v Chapter 1: Advanced User Management 1 Managing users and groups from GUI and the command line 1 Quotas 3 Password aging 10 Setting the password policy 11 Configuring password aging and password length 12 Configuring password complexity and limiting reused password usage 13 Configuring login failures 14 Sudoers 16 visudo 16 Reference 20 Summary 20 Chapter 2: Security 21 Introducing SELinux 21 Installing SELinux 23 SELinux mode 24 SELinux policy 30 SELinux files and processes 36 Domain transition 43 SELinux users 47 Restricting access to su or sudo 51 Restricting permissions to run scripts 51 Restricting access to services SELinux audit logs SELinux troubleshooting Summary 52 53 54 54 [i] Table of Contents Chapter 3: Linux for Different Purposes 55 Configuring a gateway server 56 Setting up a VPN server 62 Implementing BIND as a DNS server 68 Setting up a web server using Apache-MySQL-PHP 75 Setting up an FTP server 90 Securing Apache and FTP with OpenSSL 92 References 95 Summary 95 Chapter 4: Mail Server with Postfix 97 Setting up and configuring of Postfix mail server 98 Setting up MariaDB for virtual domains and users 103 Setting up a mail tool (Dovecot) to retrieve mails 108 Configuring the OpenLDAP Active Directory with Postfix 116 Securing the mail server using SSL/TLS 119 References 122 Summary 123 Chapter 5: Monitoring and Logging 125 Open source monitoring tools 125 Ganglia 126 OpenNMS 127 Zabbix 129 Zenoss 130 Nagios 132 Icinga 132 Setting up Nagios as a monitoring server 134 Tools to set up a logging server 144 Rsyslog 145 Syslog-ng 145 Setting up and configuring Syslog-ng 146 References 150 Summary 151 Chapter 6: Virtualization 153 The basics of virtualization on Linux 154 Full virtualization 157 Paravirtualization 158 Setting up Xen on CentOS 7 159 Setting up KVM for full virtualization on CentOS 7 164 [ ii ] Table of Contents Setting up OpenVZ virtualization on CentOS 7 169 Setting up VirtualBox virtualization on CentOS 7 173 Setting up Docker on CentOS 7 178 Establishing services' high availability using HAProxy 181 References 186 Summary 187 Chapter 7: Cloud Computing 189 An overview of cloud computing 189 Software as a Service 191 Platform as a Service (PaaS) 192 Infrastructure as a Service (IaaS) 193 Cloud computing services 194 Public cloud 195 Private cloud 195 Hybrid cloud 196 Introducing OpenStack 197 OpenStack compute 198 OpenStack networking 199 OpenStack storage 199 Components of OpenStack 200 Installing and configuring OpenStack 201 References 219 Summary 219 Chapter 8: Configuration Management 221 Introducing configuration management 221 Open source configuration management tools 223 Chef 223 SaltStack (Salt) 225 Ansible 228 Puppet 229 Installing and configuring Puppet 231 References 243 Summary 244 Chapter 9: Some Additional Tricks and Tools 245 SSH for remote connection 246 Securing SSH and the root login configuration 248 SSH key-based authentication 250 Installing and configuring SpamAssassin 251 [ iii ] Table of Contents Setting up the Clamav antivirus 252 Configuring Mytop for a MySQL database 257 Setting up Samba and NFS for file sharing 259 Introducing the Linux system and network monitoring tools 265 References Summary Index 270 270 271 failures 14 Sudoers 16 visudo 16 Reference 20 Summary 20 Chapter 2: Security 21 Introducing SELinux 21 Installing SELinux 23 SELinux mode 24 SELinux policy 30 SELinux files and processes 36 Domain transition 43 SELinux users 47 Restricting access to su or sudo 51 Restricting permissions to run scripts 51 Restricting access to services SELinux audit logs SELinux troubleshooting Summary 52 53 54 54 [i] Table of Contents Chapter 3: Linux for Different Purposes 55 Configuring a gateway server 56 Setting up a VPN server 62 Implementing BIND as a DNS server 68 Setting up a web server using Apache-MySQL-PHP 75 Setting up an FTP server 90 Securing Apache and FTP with OpenSSL 92 References 95 Summary 95 Chapter 4: Mail Server with Postfix 97 Setting up and configuring of Postfix mail server 98 Setting up MariaDB for virtual domains and users 103 Setting up a mail tool (Dovecot) to retrieve mails 108 Configuring the OpenLDAP Active Directory with Postfix 116 Securing the mail server using SSL/TLS 119 References 122 Summary 123 Chapter 5: Monitoring and Logging 125 Open source monitoring tools 125 Ganglia 126 OpenNMS 127 Zabbix 129 Zenoss 130 Nagios 132 Icinga 132 Setting up Nagios as a monitoring server 134 Tools to set up a logging server 144 Rsyslog 145 Syslog-ng 145 Setting up and configuring Syslog-ng 146 References 150 Summary 151 Chapter 6: Virtualization 153 The basics of virtualization on Linux 154 Full virtualization 157 Paravirtualization 158 Setting up Xen on CentOS 7 159 Setting up KVM for full virtualization on CentOS 7 164 [ ii ] Table of Contents Setting up OpenVZ virtualization on CentOS 7 169 Setting up VirtualBox virtualization on CentOS 7 173 Setting up Docker on CentOS 7 178 Establishing services' high availability using HAProxy 181 References 186 Summary 187 Chapter 7: Cloud Computing 189 An overview of cloud computing 189 Software as a Service 191 Platform as a Service (PaaS) 192 Infrastructure as a Service (IaaS) 193 Cloud computing services 194 Public cloud 195 Private cloud 195 Hybrid cloud 196 Introducing OpenStack 197 OpenStack compute 198 OpenStack networking 199 OpenStack storage 199 Components of OpenStack 200 Installing and configuring OpenStack 201 References 219 Summary 219 Chapter 8: Configuration Management 221 Introducing configuration management 221 Open source configuration management tools 223 Chef 223 SaltStack (Salt) 225 Ansible 228 Puppet 229 Installing and configuring Puppet 231 References 243 Summary 244 Chapter 9: Some Additional Tricks and Tools 245 SSH for remote connection 246 Securing SSH and the root login configuration 248 SSH key-based authentication 250 Installing and configuring SpamAssassin 251 [ iii ] Table of Contents Setting up the Clamav antivirus 252 Configuring Mytop for a MySQL database 257 Setting up Samba and NFS for file sharing 259 Introducing the Linux system and network monitoring tools 265 References Summary Index 270 270 271