# Changes between Version 17 and Version 18 of ESGF-Security

Ignore:
Timestamp:
Apr 16, 2013 12:44:20 PM (9 years ago)
Comment:

Cambios corregidos de Barron Jr, Tom O

Unmodified
Added
Removed
Modified
• ## ESGF-Security

 v17 Before publishing test datasets, it is necessary to install some security components and filters to support ESGF-Security. == Enable Tomcat SSL security == To enable ssl we need a valid certificate from a Certificate Authority such as Verisign. We can create one although the browser will not recognize as trusted. We will need two files: keystore and truststore. A keystore is a file which contains private keys and certificates. The certificates are sent to the remote server in a SSLConnection. A truststore contains the CA certificates you are willing to trust when a remote party presents its certificate. === Install and configure SSL support on Tomcat 6 === == Keystore and Truststore == To enable SSL we need a valid certificate from a Certificate Authority such as Verisign, Geotrust... although we can create one but the browser will not recognize it as trusted. We will need two files: keystore and truststore. A keystore is a file which contains private keys and certificates. The certificates are sent to the remote server in a SSL connection. A Truststore contains the CA certificates you are willing to trust when a remote party presents its certificate. You have two options to get these files: 1.Download the original esg-truststore and prepare your own certificates or download our esg-truststore [[attachment:esg-truststore.ts]] and Keystore [[attachment:.keystore]] which are prepared for localhost. 2.Create your own keypair following this process: === Keystore creation === Create a keystore file to store the server's private key and self-signed certificate by executing the following: '''Important: set your hostname as CN.''' (See error "Target is not trusted" [[http://esgf.org/wiki/Security/FAQ]]). For example, if you are deploying tomcat for testing in your own machine use CN=localhost. {{{ keytool -genkey -alias tomcat -keyalg RSA password: changeit }}} This command will create a file in your user home directory named ".keystore". This keystore contains the server certificate whose alias is ''localhost''. Download the ESGF Truststore which contains the trusted CA's and add your localhost certificate: 1. You can download the ESGF truststore from here https://rainbow.llnl.gov/dist/certs/esg-truststore.ts and add your tomcat certificate by yourself or download the [[attachment:esg-truststore.ts]] which contains the tomcat pem. You can also download the [[attachment:.keystore]] 2. Uncomment the ''SSL HTTP/1.1 Connector'' entry in '''$CATALINA_HOME/conf/server.xml''' and add the following: '''Important: set your hostname as CN.''' (See error "Target is not trusted" [[http://esgf.org/wiki/Security/FAQ]]). For example, if you are deploying tomcat for testing in your own machine use CN=localhost and alias localhost. {{{ keytool -genkey -alias localhost -keyalg RSA Enter keystore password: Re-enter new password: What is yout first and last name?: [Unknown]: localhost What is the name of your organizational unit? [Unknown]: MACC What is the name of your organization? [Unknown]: UNICAN What is the name of your City or Locality? [Unknown]: Santander What is the name of your State or Province? [Unknown]: Cantabria What is the two-letter country code for this unit? [Unknown]: ES Is CN=localhost, OU=MACC, O=UNICAN, L=SANTANDER, ST=CANTABRIA, C=ES correct? [no]: yes Enter key password for (RETURN if same as keystorepassword): Re-enter new password: }}} This command will create a file in your user home directory named ".keystore". This Keystore contains the server certificate whose alias is ''localhost''. Find the .keystore file in your user folder and check if it is ok with the following command: {{{ keytool -list -v -keystore .keystore }}} The result it would be something like this: {{{ Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry Alias name: localhost Creation date: 13-mar-2013 Entry type: PrivateKeyEntry Certificate chain lenght: 1 Certificate[1]: Owner: CN=localhost, OU=MACC, O=UNICAN, L=SANTANDER, ST=CANTABRIA, C=ES Emisor: CN=localhost, OU=MACC, O=UNICAN, L=SANTANDER, ST=CANTABRIA, C=ES Serial number: 355b667a Valid from: Wed Mar 13 10:21:02 CET 2013 until: Tue Jun 11 11:21:02 CEST 2013 Certificate fingerprints: MD5: 51:FE:89:BA:40:9D:AB:92:DD:22:58:11:60:E3:E6:F7 SHA1: 1E:11:8D:31:2F:43:6D:69:5C:F8:29:51:13:50:C5:37:FB:DF:61:E2 SHA256: 33:34:97:34:21:81:8A:AE:36:9C:A5:C6:24:90:55:45:89:61:1F:C6:14: signature algorithm name: SHA256withRSA Version: 3 ... ... }}} === Truststore creation === Download the original ESGF truststore from here https://rainbow.llnl.gov/dist/certs/esg-truststore.ts and add your host certificate. For this process you have to export the localhost certificate from .keystore and import to esg-truststore.ts: {{{ keytool -export -alias localhost -keystore .keystore -rfc -file localhost.cer keytool -import -alias localhost -file localhost.cer }}} Check if esg-truststore.ts contains the localhost certificate: {{{ keytool -list -v -keystore esg-truststore.ts -alias localhost }}} == Configure SSL support on Tomcat 6 == 1. Uncomment the ''SSL HTTP/1.1 Connector'' entry in '''$CATALINA_HOME/conf/server.xml''' and add the following: {{{ }}} 3. Add the truststore to the classpath (it will be required by Java) Edit '''$CATALINA_HOME/bin/setclasspath.bat''' (windows) or '''$CATALINA_HOME/bin/setclasspath.sh''' (Linux) and add the following: {{{ rem Windows clientAuth="want" keystoreFile="$CATALINA_HOME/config_files/esg-orp/.keystore" keystorePassword="changeit" truststoreFile="$CATALINA_HOME/config_files/esg-orp/esg-truststore.ts" truststorePass="changeit" sslProtocol="TLS" /> }}} '''Note: It is a good practise creating a config folder into $CATALINA_HOME which contains our certificates. These certificates will be available to the deployed apps.''' 2. Add the truststore to the classpath (it will be required by Java): Windows: edit '''%CATALINA_HOME%/bin/setclasspath.bat''' {{{ set "JAVA_OPTS=-Xmx2560m -Xms2560m -Ddebug=true -Djavax.net.ssl.trustStore=%CATALINA_HOME%/config_files/esg-orp/esg-truststore.ts -Djavax.net.ssl.trustStorePassword=changeit" echo %JAVA_OPTS% }}} Linux: edit '''$CATALINA_HOME/bin/setclasspath.sh''' {{{ set "JAVA_OPTS=-Xmx2560m -Xms2560m -Ddebug=true -Djavax.net.ssl.trustStore=$CATALINA_HOME/config_files/esg-orp/esg-truststore.ts -Djavax.net.ssl.trustStorePassword=changeit" echo %JAVA_OPTS% }}} === Deploy and configure ESG-ORP=== echo$JAVA_OPTS }}} == Configuration of ESG-ORP and deployment == 1. Start tomcat server. Run '''$CATALINA_HOME/bin/startup.bat on windows''' or '''$CATALINA_HOME/bin/startup.sh''' on Linux 1. Download [[attachment:esg-orp.war]] and move it to '''$CATALINA_HOME/webapps'''. A new directory called 'esg-orp' will be created by Tomcat. 2. Download [[attachment:esg-orp.war]] and move it to '''$CATALINA_HOME/webapps'''. A new directory called 'esg-orp' will be created by Tomcat. }}} ESG-ORP manages a list that is used to allow the idp's. It is called whitelist. The idp's are entities which provide an openid login and return a valid cookie. We will need two lists and you can download them from here [[attachment:esgf_idp.xml]] [[attachment:esgf_idp_static.xml]]. If your idp is not contained by ''esgf_idp_static.xml'' just add your idp to the file. It is recommended to save these files in '''WEB-INF/classes/esg/config''' to work properly in all environments because Windows paths are not considered by the momment. The whitelist files are read by '''WEB-INF/classes/esg/orp/orp/config/security-context-auth.xml''' Go to the line 84 and replace it with this line: {{{ ESG-ORP manages a list that is used to allow the idp's. It is called whitelist. The idp's are entities which provide an openid login and return a valid cookie. ESG-ORP reads the idp's from two lists: esgf_idp and esgf_idp_static.xml. The file esgf_idp_static.xml contains a static list of idp's and we can add all the idps that wee need. The original files contianed in ESG-ORP does not contain idp's such as PCMDI9 so you can download our whitelist from here which contains most of them: [[attachment:esgf_idp.xml]] [[attachment:esgf_idp_static.xml]]. You can also add the idp's that you want as well. We have to indicate to ESG-ORP where our whitelists are placed. Go to the file '''WEB-INF/classes/esg/orp/orp/config/security-context-auth.xml''' and find the property idpWhiteListFile. Replace it with this line: {{{ }}} == TDS Configuration == Firstable, copy the following jars onto the TDS ''WEB-INF/lib directory'' [[attachment:"thredds_esg_security_libraries.zip​"]] After that, edit the file '''$CATALINA_HOME/webapps/thredds/WEB-INF/web.xml''' and insert the XML snippet that configures the ESG access control filters to intercepts all requests sent to the TDS. You must configure the filter parameters to values that are specific to your system, specifically: Firstly, copy these jars onto the TDS ''WEB-INF/lib directory'' [[attachment:"thredds_esg_security_libraries.zip​"]] After that, edit the file '''$CATALINA_HOME/webapps/thredds/WEB-INF/web.xml''' and insert the XML snippet that configures the ESG access control filters to intercept all requests sent to the TDS. You must configure the filter parameters to values that are specific to your system, specifically: {{{