Changes between Initial Version and Version 1 of Web/SecureProfileDelivery


Ignore:
Timestamp:
Mar 20, 2010, 10:15:51 PM (16 years ago)
Author:
loomis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Web/SecureProfileDelivery

    v1 v1  
     1[[TracNav]]
     2
     3= Introduction =
     4In Quattor, profiles contain very sensitive information: sudo configuration, password hashes and even cleartext passwords. It's obvious that they shouldn't be transmitted on untrusted channels, nor to unauthorized peers.
     5We'll explain here how to use X.509 certificates to authenticate clients and servers, and a few Apache directives to avoid that an authenticated client downloads a profile other than his own.
     6
     7= The manual way =
     8== Setting up the CA ==
     9Administering a CA is a complex task. Here we'll only sketch how to set a mini-CA, with the help of OpenSSL.
     10If you are using a Red Hat variant, the easiest way is to use the package openss-perl for this. It contains a script called CA.pl, which will do everything we need.
     11 /etc/pki/tls/misc/CA.pl -newca
     12Then, answer all the questions it will prompt. You'll find your generated CA on ../../CA.
     13
     14== Generating certificates for each node ==
     15You can use the same script to generate certificates for each node, and then manually distribute them. You should not use a password for the private keys, as you want the node to access the certificate with no human interaction. Please note that packaging the certificates in an RPM is ''dangerous''.
     16
     17= Using SINDES =
     18The above solution doesn't scale if you have many nodes. Instead, it's much better to automate the node profile generation, and to do it in a way the private key doesn't travel on the network. At CERN, and on the Quattor community, the favourite tool for this is [https://twiki.cern.ch/twiki/bin/view/FIOgroup/SinDes SINDES].
     19It requires a database as its backend, but if you are running a mid-sized site chances are that you already have one, so there is no overhead.
     20We'll show now how to use SINDES with Quattor, based on [http://quattor.begrid.be/trac/centralised-begrid-v5/wiki/BEgridClientv5#webservice BEgrid's instructions].
     21== Generating the CA ==
     22Install the package SINDES-ca, which is available at CERN's repository. **I need a link here!!** Then, edit /etc/sindes/ca.config; make sure to set O, OU and CN.
     23
     24 [ req_distinguished_name ]
     25 O = IIHE
     26 OU = GRID
     27 CN = Local BEgrid client CA
     28
     29Edit /etc/sindes/sindesrc: in [MISC], set correctly domain (and use it correctly in sindessh !).
     30Next, set the default validity of the certificates, f.i, 10 years:
     31
     32 default_days = 3650
     33
     34Run "sindes-bootstrap-ca -a" to generate all certificates etc, and check the output carefully. This also generates a rpm with the CA certifiacte called {{eg}}.
     35Now, edit /etc/httpd/conf.d/sindes-ssl.conf, and make sure your profile directory is not readable by any other virtual host.
     36
     37== Configuring the AII server ==
     38Edit /etc/aii/aii-shellfe.conf to ensure it uses the correct certificates, too:
     39
     40 cdburl = https://f.q.d.n/profiles
     41 cert_file = /etc/sindes/certs/apache.crt
     42 key_file = /etc/sindes/keys/apache.key
     43 ca_file = /etc/sindes/certs/ca.crt
     44
     45== Node configuration ==
     46Nodes should request their certificate during the installation. And it should be granted to them, so the SINDES time window should be open by that time. For this, we need a few extra configurations on the node's profile.
     47
     48=== Enabling the sindes_getcert component ===
     49
     50You'll have to include somewhere on your profile:
     51
     52 include {'components/sindes_getcert/config'};
     53
     54Next, you have to install the SINDES-client package:
     55
     56 "/software/packages"=pkg_repl("SINDES-client","1.0.0-3","noarch");
     57
     58(check that package is already present on your repositories!!). Now, we choose the X.509 fields for our certificate and assign them to the component's tree:
     59
     60 "/software/components/sindes_getcert/x509_O" = "desired crt /o field";
     61 "/software/components/sindes_getcert/x509_OU" = "desired crt /ou field";
     62
     63Next, decide where to store the certificate, key and CA information:
     64
     65 "/software/components/sindes_getcert/cert_dir" = "/etc/sindes/certs";
     66 "/software/components/sindes_getcert/client_key" = "client_key.pem";
     67 "/software/components/sindes_getcert/client_cert" = "client_cert.pem";
     68 "/software/components/sindes_getcert/client_cert_key" = "client_cert_key.pem";
     69 "/software/components/sindes_getcert/ca_cert" = SINDES_SITE_CA_CERT_NAME;
     70 "/software/components/sindes_getcert/ca_cert_rpm" = SINDES_SITE_CA_RPM_NAME;
     71
     72
     73=== Configuring AII ===
     74
     75During the node's installation, it must use the values of the sindes_getcert component to generate the certificates. We said we want to download the profile only if there is a certificate. How do we solve this?
     76Easy: let AII configure SINDES first, then generate the certificates and finally, download the profile. We handle this with a simple AII hook, present in SVN. Its name is <tt>aii-sindes</tt>.
     77
     78 "/system/aii/hooks/post_reboot/0/module" = "aii_sindes";
     79 "/system/aii/hooks/remove/0/module" = "aii_sindes";
     80 "/system/aii/hooks/boot/0/module" = "aii_sindes";
     81
     82The {{remove}} hook will make all actions needed to revoke the host's certificate. The {{boot}} hook will open the time window. The {{post_reboot}} hook will generate the bash script that will request the certificates during the node's installation.
     83
     84= Configuring CCM =
     85No matter the way you choose for generating your certificates, you need to tell CCM to use them to download the profile. Just set the following on the profile:
     86
     87 "/software/components/ccm/key_file" = "/path/to/key/file";
     88 "/software/components/ccm/cert_file" = "/path/to/cert/file";
     89 "/software/components/ccm/ca_file" = "/path/to/ca/file";
     90 "/software/components/ccm/ca_dir" = "/path/to/ca/dir";
     91 "/software/components/ccm/world_readable"= 0;
     92
     93If you use SINDES, those paths can be automatically derived, like this:
     94
     95 "/software/components/ccm/key_file" =
     96     value("/software/components/sindes_getcert/cert_dir") + "/" +
     97     value("/software/components/sindes_getcert/client_key");
     98 "/software/components/ccm/cert_file" =
     99     value("/software/components/sindes_getcert/cert_dir") + "/" +
     100     value("/software/components/sindes_getcert/client_cert");
     101 "/software/components/ccm/ca_file" =
     102     value("/software/components/sindes_getcert/cert_dir") + "/" +
     103     value("/software/components/sindes_getcert/ca_cert");
     104 "/software/components/ccm/ca_dir" =
     105     value("/software/components/sindes_getcert/cert_dir");
     106 "/software/components/ccm/world_readable"= 0;
     107
     108= Configuring Apache =
     109Make sure your profile directory is not readable by any other virtual host. We will need to check that the certificate belongs to the node that presents it, so we allow DNS lookups:
     110
     111 HostnameLookups On
     112
     113Now, restrict the access to the profiles directory:
     114
     115 <Directory "/var/www/https/profiles">
     116     Options +Indexes
     117     SSLOptions +StdEnvVars
     118     SSLRequireSSL
     119     SSLVerifyClient require
     120     SSLOptions +StrictRequire
     121     SSLVerifyDepth 1
     122     SSLOptions +OptRenegotiate
     123     SSLRequire %{SSL_CLIENT_S_DN_CN} eq %{REMOTE_HOST}
     124 </Directory>
     125
     126Finally, the installation server is special: it must be allowed to download all profiles, to generate the appropriate Kickstarts:
     127
     128 RewriteMap ACLmap txt:/var/www/acl/ACLmap.txt
     129 RewriteCond ${ACLmap:%{REMOTE_HOST}|NO} NO
     130 RewriteRule ^/profiles/.*$ /profiles/profile_%{REMOTE_HOST}.xml
     131
     132And to let the install server to download all profiles, edit /var/www/acl/ACLmap.txt:
     133
     134 echo aii-server.my.domain YES > /var/www/acl/ACLmap.txt
     135
     136= References =
     137The SINDES instructions and Apache configuration are based on [http://quattor.begrid.be/trac/centralised-begrid-v5/wiki/BEgridClientv5#webservice BEgrid's instructions]