Security For Linux On System Z

Transcription

Front coverSecurity for Linux onSystem zLearn about the new cryptographyfunctions in the CEX3CDeploy security-relatedtechnologies in Linux on System zUnderstand protected keycryptographyLydia ParzialeJonathan BarneyVic CrossWilliam JohnstonEduardo KienetzEric MarinsNilesh PatelSri Venkatesenibm.com/redbooks

International Technical Support OrganizationSecurity for Linux on System zJanuary 2013SG24-7728-01

Note: Before using this information and the product it supports, read the information in “Notices” onpage ix.Second Edition (January 2013)This edition applies to Version 6, Release 2, RSU 1101 of z/VM, SUSE Linux Enterprise Server version 11Service Pack 2 and Red Hat Enterprise Linux version 6.2. Copyright International Business Machines Corporation 2010, 2013. All rights reserved.Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP ScheduleContract with IBM Corp.

ContentsNotices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixTrademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiThe team who wrote this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiNow you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiiComments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiiStay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivChapter 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.1 Hardware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.2 z/VM configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.3 Other software used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.4 Disk storage configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12222Chapter 2. The z/VM security management support utilities . . . . . . . . . . . . . . . . . . . . . 32.1 The need for security management in z/VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.1 Scaling up the proof-of-concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 External security management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2.1 z/VM internal security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2.2 Reasons to use an ESM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.3 Selective enablement of an ESM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3 User directory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3.1 User management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3.2 Disk management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Securing console access to z/VM virtual machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4.1 The role of console management in securing your environment . . . . . . . . . . . . . . 92.4.2 The z/VM LOGONBY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4.3 Using a console management utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.5 Securing network access to z/VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.5.1 X.509v3 digital certificates and trust hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . 152.5.2 z/VM Telnet server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.5.3 z/VM FTP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.6 Securing z/VM resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.6.1 Built-in security features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.6.2 Securing z/VM resources with RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.6.3 Securing TCP/IP service machines with RACF . . . . . . . . . . . . . . . . . . . . . . . . . . 322.6.4 Centralized authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322.6.5 Centralized audit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.7 z/VM Directory Maintenance Facility (DirMaint) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412.7.1 DirMaint features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412.7.2 Customizing DirMaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422.7.3 Using DirMaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482.8 Other ESM and directory manager security observations in this book . . . . . . . . . . . . . 50Chapter 3. Configuring and using the System z LDAP servers . . . . . . . . . . . . . . . . . .3.1 The z/VM and z/OS LDAP servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3.1.1 z/VM LDAP server backends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3.1.2 The relationship between the LDAP servers and RACF . . . . . . . . . . . . . . . . . . . . Copyright IBM Corp. 2010, 2013. All rights reserved.51525253iii

3.2 Setting up the z/OS LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533.2.1 Using dsconfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533.3 Setting up the z/VM LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553.3.1 Activating the z/VM LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553.3.2 Adding schema supplied by IBM to LDBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593.4 Extending the LDBM schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593.4.1 LDAP schema dependencies for Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603.4.2 Extending the schema of the z/VM LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . 613.5 LDBM and native authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663.5.1 LDBM record with the userPassword attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . 663.5.2 Creating a RACF account for an LDAP user. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673.5.3 Identifying the RACF account corresponding to the LDAP object. . . . . . . . . . . . . 673.6 Access control lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673.6.1 ACL permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683.6.2 ACL format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683.6.3 Propagating ACLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693.6.4 Updating ACLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703.7 Linux authentication using the z/VM LDAP server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713.7.1 Using YaST to enable LDAP on SLES 11 SP2. . . . . . . . . . . . . . . . . . . . . . . . . . . 713.7.2 Enabling LDAP authentication on RHEL 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743.7.3 Mapping the LDAP account to RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763.7.4 Password management with Linux and the z/VM LDAP server . . . . . . . . . . . . . . 813.8 Using an OpenLDAP server with the z/VM LDAP server . . . . . . . . . . . . . . . . . . . . . . . 863.8.1 The OpenLDAP rewrite-remap overlay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863.8.2 Configuring OpenLDAP to authenticate using z/VM LDBM . . . . . . . . . . . . . . . . . 863.8.3 Configuring OpenLDAP to authenticate using z/VM SDBM . . . . . . . . . . . . . . . . . 883.8.4 RACF password management with OpenLDAP slapo rwm . . . . . . . . . . . . . . . . . 923.9 Centralizing Linux audit information with z/VM RACF. . . . . . . . . . . . . . . . . . . . . . . . . . 923.9.1 Enabling extended operations support in z/VM LDAP server . . . . . . . . . . . . . . . . 933.9.2 RACF configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943.9.3 Adding the @LINUX class to RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953.9.4 Linux configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973.10 Using z/VM LDAP in an SSI cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983.10.1 LDAP server high availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983.10.2 z/VM LDAP server clustering for the LDBM backend . . . . . . . . . . . . . . . . . . . . . 993.10.3 z/VM LDAP server clustering for the SDBM backend . . . . . . . . . . . . . . . . . . . . 101Chapter 4. Authentication and access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1 SELinux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1.1 Important files and directories for SELinux . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1.2 Enabling SELinux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1.3 Disabling SELinux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1.4 Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.1.5 RPMs required for SELinux. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.2 AppArmor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.2.1 Important files and directories for AppArmor. . . . . . . . . . . . . . . . . . . . . . . . . . . .4.2.2 Enable or disable AppArmor by using YaST. . . . . . . . . . . . . . . . . . . . . . . . . . . .4.2.3 RPMs required for AppArmor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.3 Pluggable Authentication Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.3.1 Important files and libraries for PAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.3.2 Enabling PAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.3.3 PAM and LDAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.4 Sudo (superuser do) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ivSecurity for Linux on System z103104104105110110111111112113116116117119124125

4.5 OpenSSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5.1 Important files and directories for OpenSSH. . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5.2 OpenSSH commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5.3 Enable or disable OpenSSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5.4 Authentication methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5.5 OpenSSH using the hardware cryptographic support of IBM System z . . . . . . .126126128129132143Chapter 5. Cryptographic hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.1 Clear key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.1.1 Accelerated Linux kernel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.1.2 Random number generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.2 File system encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.2.1 Key management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.3 Cryptographic APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.4 Securing communication and applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.5 Statistics and performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.6 Secure Key Crypto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.6.1 Comparing secure key, clear key, and protected key operations . . . . . . . . . . . .5.6.2 Secure key functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5.7 Set up of CPACF, Crypto Express3, and Crypto Express4. . . . . . . . . . . . . . . . . . . . .5.7.1 Toleration mode versus exploitation mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151152152153155163164174181183183184185185Chapter 6. Physical and infrastructure security on System z. . . . . . . . . . . . . . . . . . .6.1 Physical environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.2 Minimal Installations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.3 Protecting the Hardware Management Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.4 Protecting the configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.5 Building a secure multizone application environment . . . . . . . . . . . . . . . . . . . . . . . . .6.5.1 The multizone concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.5.2 Controlling the zones with RACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.5.3 Using HiperSockets as part of your network solution . . . . . . . . . . . . . . . . . . . . .6.6 IBM security solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.6.1 IBM Security Network Intrusion Prevention system . . . . . . . . . . . . . . . . . . . . . .6.6.2 IBM Tivoli zSecure Manager for RACF z/VM . . . . . . . . . . . . . . . . . . . . . . . . . . .6.6.3 IBM Tivoli Endpoint Manager for Patch Management. . . . . . . . . . . . . . . . . . . . .6.6.4 IBM Tivoli Endpoint Manager for Security and Compliance . . . . . . . . . . . . . . . .6.6.5 IBM Tivoli Access Manager WebSEAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.7 Linux firewalls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.7.1 The ebtables tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.7.2 The iptables tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.7.3 Linux firewall tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.8 Disk security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.8.1 Traditional mainframe environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.8.2 Modern environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.9 Protecting ECKD disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.9.1 Shared-DASD configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.9.2 LPAR configuration for Linux workloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.10 Protecting Fibre Channel Protocol (FCP) disks. . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.10.1 Using FBA emulation in z/VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.10.2 Using N Port ID Virtualization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.11 Protecting z/VM minidisks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.11.1 Minidisk access security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.11.2 Overlapping minidisks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tsv

6.11.3 Minidisk-owning user. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2396.11.4 Shared DASD considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240viChapter 7. Security implications of z/VM SSI and LGR . . . . . . . . . . . . . . . . . . . . . . . .7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7.2 Lab environment configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7.2.1 Background information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7.2.2 Physical and logical configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7.2.3 Proposed tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7.2.4 Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241242243244245257264Chapter 8. Best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.1 Security checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.2 Physical security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.3 Securing the logical access to z/VM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.3.1 z/VM user passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.3.2 Choosing the z/VM privilege class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8.3.3 z/VM network connection . . . . . . . . . . . . . . . . . .

This edition applies to Version 6, Release 2, RSU 1101 of z/VM, SUSE Linux Enterprise Server version 11 Service Pack 2 and Red Hat Enterprise Linux version 6.2. Note: Before using this information and the product i