With this version, and Ade's patch posted to the PKI list, we have a functioning proxy.

I still need to do some cleanup in the /etc/httpd/conf.d directory: the modifications to nss.conf are not removed in uninstall, nor is the symlink to /etc/pki-ca/proxy.conf.

We also need to limit the number of suburls of the PKI CA that the proxy exposes. This version exposes all of the. I think we need a very limited subset.

I've created a replica --no-pki and successfully requested a certificate on it.


On 08/19/2011 01:57 PM, Dmitri Pal wrote:
On 08/19/2011 01:19 PM, Adam Young wrote:
The complete solution for this patch requires changes in Dogtag that Ade Lee is working on right now. In order to test, I have provided a couple of files that I have been using:


1. Apply patch, build and install IPA rpms, run ipaserver-install as per usual.
2.  Move the dogtag.conf file into /etc/httpd/conf.d directorys
3. Run the proxy_dogtag.py script to modify the Dogtag instance to accept AJP connections from httpd so httpd can act as a proxy
4. Restart IPA


To test:

1. add a host.
2. Generate a csr: http://freeipa.org/page/Certificate_Authority#Request_a_certificate
3.  request a certificate for the newly added host.
4.  Optionally, Revoke the certificate for the host



Please do not forget to test the proxy test when replica does not have the CA installed and has to forward the request to the one that has.



_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


--
Thank you,
Dmitri Pal

Sr. Engineering Manager IPA project,
Red Hat Inc.


-------------------------------
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/




_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

From 3f0997d97a5815244ea7038b0f207e31d2b857cb Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Wed, 17 Aug 2011 15:36:18 -0400
Subject: [PATCH] enable proxy for dogtag

Dogtag is going to be proxied through httpd.  To make this work, it has to support renegotiation of the SSL
connection.  This patch enables renegotiate in the nss configuration file during during apache configuration,
as well as modifies libnss to set the appropriate optins on the ssl connection in order to  renegotiate.

The IPA install uses the internal ports instead of proxying through
httpd since  httpd is not set up yet.

IPA needs to Request the certificate through a port that uses authentication.  On the Dogtag side, they provide an additional mapping for this:   /ca/eeca/ca as opposed tp /ca/ee/ca  just for this purpose.

https://fedorahosted.org/freeipa/ticket/1334

add flag to pkicreate in order to enable using proxy.

adding /etc/http/conf.d/ symlink to  /etc/pki-ca/proxy.conf.
---
 ipalib/constants.py               |   10 +++++++---
 ipapython/dogtag.py               |    2 +-
 ipapython/nsslib.py               |   15 ++++++++++++++-
 ipaserver/install/cainstance.py   |    7 +++++++
 ipaserver/install/certs.py        |    4 ++--
 ipaserver/install/httpinstance.py |    5 +++++
 ipaserver/plugins/dogtag.py       |    2 +-
 7 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/ipalib/constants.py b/ipalib/constants.py
index 026e0735441eabf8dbe63fffa85da69aa151c5d7..244360fe17dee4ff91b561fb6e3f7b5f4e443726 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -136,9 +136,13 @@ DEFAULT_CONFIG = (
 
     # CA plugin:
     ('ca_host', FQDN),  # Set in Env._finalize_core()
-    ('ca_port', 9180),
-    ('ca_agent_port', 9443),
-    ('ca_ee_port', 9444),
+    ('ca_port', 80),
+    ('ca_agent_port', 443),
+    ('ca_ee_port', 443),
+    ('ca_install_port', 9180),
+    ('ca_agent_install_port',9443 ),
+    ('ca_ee_install_port',9444 ),
+
 
     # Special CLI:
     ('prompt_all', False),
diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py
index 969535e4b95d3fc7f7f5202000bb29deef558e32..02f981974e1047a880ed05e428a86b4a4d4a6c21 100644
--- a/ipapython/dogtag.py
+++ b/ipapython/dogtag.py
@@ -34,7 +34,7 @@ def get_ca_certchain(ca_host=None):
     if ca_host is None:
         ca_host = api.env.ca_host
     chain = None
-    conn = httplib.HTTPConnection(ca_host, api.env.ca_port)
+    conn = httplib.HTTPConnection(ca_host, api.env.ca_install_port)
     conn.request("GET", "/ca/ee/ca/getCertChain")
     res = conn.getresponse()
     doc = None
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index e347d217992a4a549413f3e33d9248a403ee68cd..a0c5a8d36921c6eef3bf4320aab0a0c544ce82fd 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -208,12 +208,25 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
         self._create_socket()
 
     def _create_socket(self):
+
+        #TODO remove the try block once python-nss is guaranteed to
+	#contain these values
+	try :
+        	ssl_enable_renegotiation  = SSL_ENABLE_RENEGOTIATION   #pylint: disable=E0602
+		ssl_require_safe_negotiation = SSL_REQUIRE_SAFE_NEGOTIATION  #pylint: disable=E0602
+		ssl_renegotiate_requires_xtn = SSL_RENEGOTIATE_REQUIRES_XTN #pylint: disable=E0602
+	except :
+        	ssl_enable_renegotiation  = 20
+		ssl_require_safe_negotiation = 21
+		ssl_renegotiate_requires_xtn = 2
+
         # Create the socket here so we can do things like let the caller
         # override the NSS callbacks
         self.sock = ssl.SSLSocket(family=self.family)
         self.sock.set_ssl_option(ssl.SSL_SECURITY, True)
         self.sock.set_ssl_option(ssl.SSL_HANDSHAKE_AS_CLIENT, True)
-
+	self.sock.set_ssl_option(ssl_require_safe_negotiation, False)
+	self.sock.set_ssl_option(ssl_enable_renegotiation, ssl_renegotiate_requires_xtn)
         # Provide a callback which notifies us when the SSL handshake is complete
         self.sock.set_handshake_callback(self.handshake_callback)
 
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index 5c6c49e4b1780e5b64815cad2c39c7994d981cd4..35324d6fd5b8ca49fbc4ff9daa3dec807bfc973b 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -257,6 +257,7 @@ class CADSInstance(service.Service):
 
         self.step("creating directory server user", self.__create_ds_user)
         self.step("creating directory server instance", self.__create_instance)
+
         self.step("restarting directory server", self.restart_instance)
 
         self.start_creation("Configuring directory server for the CA", 30)
@@ -476,6 +477,7 @@ class CAInstance(service.Service):
         """
         return os.path.exists(self.server_root + '/' + PKI_INSTANCE_NAME)
 
+
     def configure_instance(self, host_name, dm_password,
                            admin_password, ds_port=DEFAULT_DSPORT,
                            pkcs12_info=None, master_host=None, csr_file=None,
@@ -537,6 +539,7 @@ class CAInstance(service.Service):
                 self.step("requesting RA certificate from CA", self.__request_ra_certificate)
                 self.step("issuing RA agent certificate", self.__issue_ra_cert)
                 self.step("adding RA agent as a trusted user", self.__configure_ra)
+            self.step("linking CA proxy configuration", self.__link_proxy_conf)
 
         self.start_creation("Configuring certificate server", 210)
 
@@ -557,6 +560,7 @@ class CAInstance(service.Service):
                 '-tomcat_server_port', str(TOMCAT_SERVER_PORT),
                 '-redirect', 'conf=/etc/pki-ca',
                 '-redirect', 'logs=/var/log/pki-ca',
+		'-enable_proxy'
         ]
         ipautil.run(args, env={'PKI_HOSTNAME':self.fqdn})
 
@@ -809,6 +813,9 @@ class CAInstance(service.Service):
         finally:
             os.remove(agent_name)
 
+    def __link_proxy_conf(self):
+        os.symlink("/etc/pki-ca/proxy.conf","/etc/httpd/conf.d/ca_proxy.conf")
+
     def __configure_ra(self):
         # Create an RA user in the CA LDAP server and add that user to
         # the appropriate groups so it can issue certificates without
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index 738b329a6edd22501dc21459f89b271d93dc2b2c..6d5231a7eaea29fa94121ad902e84708742c9d99 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -631,7 +631,7 @@ class CertDB(object):
             password = f.readline()
             f.close()
             http_status, http_reason_phrase, http_headers, http_body = \
-                dogtag.https_request(self.host_name, api.env.ca_ee_port, "/ca/ee/ca/profileSubmitSSLClient", self.secdir, password, "ipaCert", **params)
+                dogtag.https_request(self.host_name, api.env.ca_ee_install_port, "/ca/ee/ca/profileSubmitSSLClient", self.secdir, password, "ipaCert", **params)
 
             if http_status != 200:
                 raise CertificateOperationError(error='Unable to communicate with CMS (%s)' % \
@@ -713,7 +713,7 @@ class CertDB(object):
             password = f.readline()
             f.close()
             http_status, http_reason_phrase, http_headers, http_body = \
-                dogtag.https_request(self.host_name, api.env.ca_ee_port, "/ca/ee/ca/profileSubmitSSLClient", self.secdir, password, "ipaCert", **params)
+                dogtag.https_request(self.host_name, api.env.ca_ee_install_port, "/ca/ee/ca/profileSubmitSSLClient", self.secdir, password, "ipaCert", **params)
             if http_status != 200:
                 raise RuntimeError("Unable to submit cert request")
 
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index d2eb27c96eb2dbf6baf5f1b24edf579cd6d0881a..d2654ba671789111fc9185702dbb358a456e5746 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -75,6 +75,7 @@ class HTTPInstance(service.Service):
         self.step("disabling mod_ssl in httpd", self.__disable_mod_ssl)
         self.step("setting mod_nss port to 443", self.__set_mod_nss_port)
         self.step("setting mod_nss password file", self.__set_mod_nss_passwordfile)
+        self.step("enabling mod_nss renegotiate", self.__enable_mod_nss_renegotiate)
         self.step("adding URL rewriting rules", self.__add_include)
         self.step("configuring httpd", self.__configure_http)
         self.step("setting up ssl", self.__setup_ssl)
@@ -160,6 +161,10 @@ class HTTPInstance(service.Service):
     def __set_mod_nss_nickname(self, nickname):
         installutils.set_directive(NSS_CONF, 'NSSNickname', nickname)
 
+    def __enable_mod_nss_renegotiate(self):
+        installutils.set_directive(NSS_CONF, 'NSSRenegotiation', 'on',False)
+        installutils.set_directive(NSS_CONF, 'NSSRequireSafeNegotiation', 'on',False)
+
     def __set_mod_nss_passwordfile(self):
         installutils.set_directive(NSS_CONF, 'NSSPassPhraseDialog', 'file:/etc/httpd/conf/password.conf')
 
diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py
index d1234a0d242339cbd77d2190d3c181fd8e8c94db..23d06abc112c41bbd9bfba5d7173ed2ae84d5752 100644
--- a/ipaserver/plugins/dogtag.py
+++ b/ipaserver/plugins/dogtag.py
@@ -1514,7 +1514,7 @@ class ra(rabase.rabase):
 
         # Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._sslget('/ca/ee/ca/profileSubmitSSLClient',
+            self._sslget('/ca/eeca/ca/profileSubmitSSLClient',
                          self.env.ca_ee_port,
                          profileId='caIPAserviceCert',
                          cert_request_type=request_type,
-- 
1.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to