Opensuse Leap 42.1 Security Guide Opensuse Leap 42.1
Total Page:16
File Type:pdf, Size:1020Kb
Security Guide openSUSE Leap 42.1 Security Guide openSUSE Leap 42.1 Introduces basic concepts of system security, covering both local and network secu- rity aspects. Shows how to use the product inherent security software like AppAr- mor or the auditing system that reliably collects information about any security-rel- evant events. Publication Date: November 05, 2018 SUSE LLC 10 Canal Park Drive Suite 200 Cambridge MA 02141 USA https://www.suse.com/documentation Copyright © 2006–2018 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Docu- mentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see http://www.suse.com/company/legal/ . All other third party trademarks are the prop- erty of their respective owners. A trademark symbol (®, ™ etc.) denotes a SUSE or Novell trademark; an asterisk (*) denotes a third party trademark. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xv 1 Security and Confidentiality 1 1.1 Local Security and Network Security 1 Local Security 3 • Network Security 6 1.2 Some General Security Tips and Tricks 10 1.3 Using the Central Security Reporting Address 12 I AUTHENTICATION 13 2 Authentication with PAM 14 2.1 What is PAM? 14 2.2 Structure of a PAM Configuration File 15 2.3 The PAM Configuration of sshd 17 2.4 Configuration of PAM Modules 20 pam_env.conf 20 • pam_mount.conf.xml 21 • limits.conf 21 2.5 Configuring PAM Using pam-config 21 2.6 Manually Configuring PAM 22 2.7 For More Information 23 3 Using NIS 24 3.1 Configuring NIS Servers 24 Configuring a NIS Master Server 24 • Configuring a NIS Slave Server 29 3.2 Configuring NIS Clients 30 iii Security Guide 4 Authentication Server and Client 32 4.1 Configuring an Authentication Server with YaST 32 Initial Configuration of an Authentication Server 32 • Editing an Authentication Server Configuration with YaST 36 • Editing LDAP Users and Groups 41 4.2 Configuring an Authentication Client with YaST (SSSD) 41 5 LDAP—A Directory Service 46 5.1 LDAP versus NIS 47 5.2 Structure of an LDAP Directory Tree 47 5.3 Configuring LDAP Users and Groups in YaST 50 5.4 Manually Configuring an LDAP Server 51 Starting and Stopping the Servers 52 5.5 Manually Administering LDAP Data 52 Inserting Data into an LDAP Directory 52 • Modifying Data in the LDAP Directory 54 • Searching or Reading Data from an LDAP Directory 55 • Deleting Data from an LDAP Directory 55 5.6 For More Information 56 6 Active Directory Support 57 6.1 Integrating Linux and AD Environments 57 6.2 Background Information for Linux AD Support 58 Domain Join 60 • Domain Login and User Homes 61 • Offline Service and Policy Support 62 6.3 Configuring a Linux Client for Active Directory 63 6.4 Logging In to an AD Domain 66 GDM 67 • Console Login 67 6.5 Changing Passwords 67 iv Security Guide 7 Network Authentication with Kerberos 69 7.1 Kerberos Terminology 69 7.2 How Kerberos Works 71 First Contact 71 • Requesting a Service 72 • Mutual Authentication 72 • Ticket Granting—Contacting All Servers 72 • Compatibility to Windows 2000 73 7.3 Users' View of Kerberos 74 7.4 Installing and Administering Kerberos 75 Kerberos Network Topology 76 • Choosing the Kerberos Realms 77 • Setting Up the KDC Hardware 77 • Configuring Time Synchronization 78 • Configuring the KDC 79 • Configuring Kerberos Clients 82 • Configuring Remote Kerberos Administration 85 • Creating Kerberos Service Principals 86 • Enabling PAM Support for Kerberos 88 • Configuring SSH for Kerberos Authentication 88 • Using LDAP and Kerberos 89 7.5 For More Information 92 II LOCAL SECURITY 93 8 Configuring Security Settings with YaST 94 8.1 Security Overview 94 8.2 Predefined Security Configurations 95 8.3 Password Settings 96 8.4 Boot Settings 96 8.5 Login Settings 97 8.6 User Addition 97 8.7 Miscellaneous Settings 97 v Security Guide 9 Authorization with PolKit 99 9.1 Conceptual Overview 99 Available Authentication Agents 99 • Structure of PolKit 99 • Available Commands 100 • Available Policies and Supported Applications 100 9.2 Authorization Types 102 Implicit Privileges 102 • Explicit Privileges 103 • Default Privileges 103 9.3 Querying Privileges 103 9.4 Modifying Configuration Files 104 Adding Action Rules 104 • Adding Authorization Rules 106 • Modifying Configuration Files for Implicit Privileges 106 9.5 Restoring the Default Privileges 107 10 Access Control Lists in Linux 109 10.1 Traditional File Permissions 109 The setuid Bit 109 • The setgid Bit 110 • The Sticky Bit 110 10.2 Advantages of ACLs 110 10.3 Definitions 111 10.4 Handling ACLs 112 ACL Entries and File Mode Permission Bits 113 • A Directory with an ACL 114 • A Directory with a Default ACL 116 • The ACL Check Algorithm 119 10.5 ACL Support in Applications 120 10.6 For More Information 120 11 Encrypting Partitions and Files 121 11.1 Setting Up an Encrypted File System with YaST 122 Creating an Encrypted Partition during Installation 122 • Creating an Encrypted Partition on a Running System 123 • Creating an Encrypted File as a Container 124 • Encrypting the Content of Removable Media 124 11.2 Using Encrypted Home Directories 125 vi Security Guide 11.3 Using vi to Encrypt Single ASCII Text Files 126 12 Certificate Store 127 12.1 Activating Certificate Store 127 12.2 Importing Certificates 127 13 Intrusion Detection with AIDE 129 13.1 Why Using AIDE? 129 13.2 Setting Up an AIDE Database 129 13.3 Local AIDE Checks 132 13.4 System Independent Checking 133 13.5 For More Information 134 III NETWORK SECURITY 135 14 SSH: Secure Network Operations 136 14.1 ssh—Secure Shell 136 Starting X Applications on a Remote Host 137 • Agent Forwarding 137 14.2 scp—Secure Copy 137 14.3 sftp—Secure File Transfer 138 Setting Permissions for File Uploads 139 14.4 The SSH Daemon (sshd) 140 14.5 SSH Authentication Mechanisms 141 Generating an SSH Key 142 • Copying an SSH Key 142 • Using the ssh- agent 143 14.6 Port Forwarding 144 14.7 For More Information 145 15 Masquerading and Firewalls 146 15.1 Packet Filtering with iptables 146 vii Security Guide 15.2 Masquerading Basics 149 15.3 Firewalling Basics 150 15.4 SuSEFirewall2 151 Configuring the Firewall with YaST 152 • Configuring Manually 155 15.5 For More Information 158 16 Configuring a VPN Server 159 16.1 Conceptual Overview 159 Terminology 159 • VPN Scenarios 160 16.2 Setting Up a Simple Test Scenario 163 Configuring the VPN Server 164 • Configuring the VPN Client 164 • Testing the VPN Example Scenario 165 16.3 Setting Up Your VPN Server Using Certificate Authority 165 Creating Certificates 166 • Configuring the Server 169 • Configuring the Clients 171 16.4 Changing Name Servers in VPN 172 16.5 The GNOME Applet 173 16.6 For More Information 174 17 Managing X.509 Certification 175 17.1 The Principles of Digital Certification 175 Key Authenticity 176 • X.509 Certificates 176 • Blocking X.509 Certificates 177 • Repository for Certificates and CRLs 178 • Proprietary PKI 179 17.2 YaST Modules for CA Management 179 Creating a Root CA 179 • Changing Password 181 • Creating or Revoking a Sub-CA 182 • Creating or Revoking User Certificates 184 • Changing Default Values 185 • Creating Certificate Revocation Lists (CRLs) 186 • Exporting CA Objects to LDAP 187 • Exporting CA Objects as a File 188 • Importing Common Server Certificates 189 viii Security Guide IV CONFINING PRIVILEGES WITH APPARMOR 190 18 Introducing AppArmor 191 18.1 Background Information on AppArmor Profiling 192 19 Getting Started 193 19.1 Installing AppArmor 193 19.2 Enabling and Disabling AppArmor 194 19.3 Choosing Applications to Profile 195 19.4 Building and Modifying Profiles 195 19.5 Updating Your Profiles 197 20 Immunizing Programs 198 20.1 Introducing the AppArmor Framework 199 20.2 Determining Programs to Immunize 201 20.3 Immunizing cron Jobs 202 20.4 Immunizing Network Applications 202 Immunizing Web Applications 204 • Immunizing Network Agents 206 21 Profile Components and Syntax 207 21.1 Breaking an AppArmor Profile into Its Parts 208 21.2 Profile Types 210 Standard Profiles 210 • Unattached Profiles 211 • Local Profiles 211 • Hats 212 • Change rules 212 21.3 Include Statements 213 Abstractions 215 • Program Chunks 215 • Tunables 215 21.4 Capability Entries (POSIX.1e) 215 21.5 Network Access Control 216 ix Security Guide 21.6 Profile Names, Flags, Paths, and Globbing 217 Profile Flags 218 • Using Variables in Profiles 219 • Pattern Matching 220 • Namespaces 221 • Profile Naming and Attachment Specification 221 • Alias Rules 222 21.7 File Permission Access Modes 222 Read Mode (r) 223 • Write Mode (w) 223 • Append Mode (a) 223 • File Locking Mode (k) 223 • Link Mode (l) 224 • Link Pair 224 • Optional allow and file Rules 224 • Owner Conditional Rules 225 • Deny Rules 226 21.8 Execute Modes 226 Discrete Profile Execute Mode (Px) 227 • Discrete Local Profile Execute Mode (Cx) 227 • Unconfined Execute Mode (Ux) 227 • Unsafe Exec Modes 228 • Inherit Execute Mode (ix) 228 • Allow Executable Mapping (m) 228 • Named Profile Transitions 228 • Fallbacks for Profile Transitions 229 • Variable Settings in Execution Modes 230 • safe and unsafe Keywords 231