User Tools

Site Tools


build:security

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
build:security [2007/06/13 14:29]
206.197.251.253
build:security [2008/02/11 02:49]
4.245.76.22
Line 1: Line 1:
 ====== Security ====== ====== Security ======
  
-After rebuilding Bud due to successful attacks, a number of suggestions were made, and some of them implemented ​to improve security:+After rebuilding Bud due to successful attacks, a number of suggestions were made, they were implemented ​as folows:
  
-===== Passwords & Groups =====+====== Passwords & Groups ​======
   * Require complex passwords   * Require complex passwords
 +  * Change all valid shells for daemon accounts to /bin/false
 +  daemon, bin, sys, games, man, mail, news, uucp, proxy, www-date, backup, list, irc, gnats, nobody, ​
   * Require PKA for all admin users   * Require PKA for all admin users
   * Create a wheel group to restrict su access   * Create a wheel group to restrict su access
-groupadd --system wheel+  ​groupadd --system wheel
   * Remove sudo entirely   * Remove sudo entirely
 +  * Provide a script to automate certification generation, providing defaults for standard data
  
-===== SSL Key Generation ​===== +====== SSL ======
- from the Omnitec Wiki+
  
-Postfix and Apache ​both use the SSL certificates in /etc/ssl/ for secure communications and TLS authenication. The guide for creating ​the keys is at openssl.htm (http://​www.nomoa.com/bsd/openssl.htm)+//​[[postfix|Postfix]], [[imap|Courier IMAP]], ​and [[apache|Apache]] all use their own SSL certificates in /etc/ssl/ for secure communications and TLS authenication. ​ The configuration files for each application will have to reflect ​the name of the certificate file See the documentation for individual applications or existing systems for the naming convention.//
  
-* Backup /etc/ssl/openssl.cnf to /etc/ssl/openssl.cnf.original and change/add defaults to be specific to SLUUG: +The guide for creating the keys is at [[http://www.nomoa.com/bsd/openssl.htm|openssl.htm]]. Additional information might be at the [[http://www.openssl.org/|OpenSSL web site]].
-  * countryName_default ​            = US +
-  * stateOrProvinceName_default ​    = Missouri +
-  * localityName_default ​           = StLouis +
-  * 0.organizationName_default ​     = St. Louis Unix User's Group +
-  * commonName_default ​             = Sysadmin +
-  * emailAddress ​                   = postmaster@sluug.org+
  
-* Generate the private server key with passphrase.+===== SSL Configuration ===== 
 + 
 +This is done once for the system. 
 + 
 +  * Backup ''/​etc/​ssl/​openssl.cnf''​ to ''/​etc/​ssl/​openssl.cnf.original''​ and change/add defaults in the req_distinguished_name section of openssl.cnf to be specific to SLUUG. ​ The ''​commonName_default''​ and ''​ organizationalUnitName_default''​ are different for each system. 
 +    * ''​countryName_default ​            = US''​ 
 +    * ''​stateOrProvinceName_default ​    = Missouri''​ 
 +    * ''​localityName_default ​           = St. Louis''​ 
 +    * ''​0.organizationName_default ​     = St. Louis Unix ''​User'​s Group 
 +    * ''​emailAddress ​                   = postmaster@sluug.org''​ 
 +    * ''​commonName_default ​             = bud.sluug.org''​ 
 +    * ''​organizationalUnitName_default ​ = bud.sluug.org''​ 
 + 
 +===== SSL Key Generation - Manual Method ===== 
 + 
 +** This entire section is duplicated below in the [[#​openssl-gencrt_script|SSL Key Generation - Script Method]] section. ​ Do one or the other, not both.** 
 + 
 +This is repeated for each application that needs it. 
 + 
 +  ​* Generate the private server key with passphrase. Enter anything for the passphrase (4 to 8191 characters),​ but will have to enter it for the next step that removes it.
 <code rootshell>​ <code rootshell>​
-openssl genrsa -des3 -out /​etc/​ssl/​private/​server.key 1024+openssl genrsa -des3 -out /​etc/​ssl/​private/​temp.key 1024
 </​code>​ </​code>​
-* Remove the passphrase (cannot use with a server)+  ​* Remove the passphrase (cannot use a passphrase ​with a server)
 <code rootshell>​ <code rootshell>​
-openssl rsa -in pass.key -out server.key+openssl rsa -in /​etc/​ssl/​private/​temp.key -out /​etc/​ssl/​private/<​name>​.key
 </​code>​ </​code>​
-* Generate the certificate request with defaults from the modified openssl.cnf. For the "​Common Name" enter the servers fqdn e.g. bud.sluug.org+  * No longer need the temporary key. 
 +<code rootshell>​ 
 +rm /​etc/​ssl/​private/​temp.key 
 +</​code>​ 
 +  ​* Generate the certificate request with defaults from the modified openssl.cnf. When running the signing request, you will be asked a number of questions about the identification of the organization and system. ​ Since these were already set in openssl.cnf,​ you should only need to verify the default value and press Carriage Return to take the default for all of them. For example, for the "​Common Name" enter the servers fqdn e.g. bud.sluug.org
 <code rootshell>​ <code rootshell>​
 openssl req -new -key /​etc/​ssl/​private/<​name>​.key -out /​etc/​ssl/​private/<​name>​.csr openssl req -new -key /​etc/​ssl/​private/<​name>​.key -out /​etc/​ssl/​private/<​name>​.csr
 </​code>​ </​code>​
  
-Self sign the certificate request to produce the certificate.+  * Self sign the certificate request to produce the certificate.
 <code rootshell>​ <code rootshell>​
 openssl x509 -req -days 3650   -in /​etc/​ssl/​private/<​name>​.csr ​  ​-signkey /​etc/​ssl/​private/<​name>​.key ​  -out /​etc/​ssl/<​name>​.crt openssl x509 -req -days 3650   -in /​etc/​ssl/​private/<​name>​.csr ​  ​-signkey /​etc/​ssl/​private/<​name>​.key ​  -out /​etc/​ssl/<​name>​.crt
 </​code>​ </​code>​
  
-Next copy the key and cert created to the /​etc/​ssl/​private/​postfix.key and /​etc/​ssl/​postfix.crt and change group so postfix ​can read it.+    * Change group and permissions as needed so the application ​can read it's own certificate For example, for postfix:
 <code rootshell>​ <code rootshell>​
-cp /​etc/​ssl/​private/​server.key /​etc/​ssl/​private/​postfix.key 
-cp /​etc/​ssl/​postfix.crt /​etc/​ssl/​postfix.crt 
 chown :postfix /​etc/​ssl/​private/​postfix.key chown :postfix /​etc/​ssl/​private/​postfix.key
 chown :postfix /​etc/​ssl/​postfix.crt chown :postfix /​etc/​ssl/​postfix.crt
 </​code>​ </​code>​
  
-  * The above commands were combined in a shell script that operates as follows: +===== SSL Key Generation - Script Method =====
-  - Launch openssl-keygen with the desired Certificate Name as an argument, +
-<code rootshell>​ +
-openssl-keygen <​Certificate Name> +
-</​code> ​    +
-  - The defaults for SLUUG are provided - a <cr> will accept them; some information is required. +
-    ​==== Defaults ​==== +
-    * Country: [US] +
-    * Locale: [St. Louis] +
-    * Organization:​ [St. Louis Unix User Group+
  
-    ==== Required ==== +**This entire section is duplicated above in the [[#​ssl_key_generation_-_manual_method|SSL Key Generation - Script Method]] section. Do one or the other, not both.**
-    ​Section Name:  +
-    ​Your name (Admin name): +
-    ​Email (Admin Email):+
  
 +This is repeated for each application that needs it.
  
 +The above commands are in a script named ''​openssl-gencrt''​ to simplify certificate creation:
  
 +  * Copy ''/​usr/​local/​sbin/​openssl-gencrt''​ from another system if not already done.
 +
 +  * Launch ''​openssl-keygen''​ with the desired Certificate Name as an argument
 +<code rootshell>​
 +openssl-gencrt <​name>​
 +</​code>​
 +
 +  * The defaults for SLUUG are provided - a <cr> will accept them; only the common name is required to be entered.
 +  * Defaults may be overridden if required
 +  * NOTE: A passphrase is required for the key - it is removed in the second step
 +
 +===== Defaults =====
 +    * Country: [US]
 +    * Locale: [St. Louis]
 +    * Organization Name: [St. Louis Unix User Group
  
  
-===== =====+===== Required ​===== 
 +    * OU Name: Server fqdn 
 +    * Common name: Function (e.g. Postfix)
  
 +  * Any of the defaults may be overridden at creation time
build/security.txt · Last modified: 2008/02/11 02:52 by 4.245.76.22