|
|
2ff659 |
From be48983558a560dadad410a70a4a1684565ed481 Mon Sep 17 00:00:00 2001
|
|
|
2ff659 |
From: Alexander Scheel <ascheel@redhat.com>
|
|
|
2ff659 |
Date: Mon, 15 Jun 2020 18:38:35 -0400
|
|
|
2ff659 |
Subject: [PATCH] Clarify AJP connector creation process
|
|
|
2ff659 |
|
|
|
2ff659 |
We do two things:
|
|
|
2ff659 |
|
|
|
2ff659 |
1. Fix the xpath for AJP connector verification. An AJP connector is
|
|
|
2ff659 |
one which has protocol="AJP/1.3", NOT one that has port="8009". An
|
|
|
2ff659 |
AJP connector can exist on any port and port 8009 can have any
|
|
|
2ff659 |
protocol. Secrets only make sense on AJP connectors, so make the
|
|
|
2ff659 |
xpath match the existing comment.
|
|
|
2ff659 |
|
|
|
2ff659 |
2. Add some background in-line documentation about AJP secret
|
|
|
2ff659 |
provisioning. This should help future developers understand why this
|
|
|
2ff659 |
was added to IPA and what limitations there are in what PKI or IPA
|
|
|
2ff659 |
can do. Most notably, explain why Dogtag can't upgrade the AJP
|
|
|
2ff659 |
connector to have a secret in the general case.
|
|
|
2ff659 |
|
|
|
2ff659 |
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
|
|
|
2ff659 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
2ff659 |
---
|
|
|
2ff659 |
ipaserver/install/dogtaginstance.py | 20 +++++++++++++++++---
|
|
|
2ff659 |
1 file changed, 17 insertions(+), 3 deletions(-)
|
|
|
2ff659 |
|
|
|
2ff659 |
diff --git a/ipaserver/install/dogtaginstance.py b/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
index 42c9db3fb..aa3baeb7c 100644
|
|
|
2ff659 |
--- a/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
+++ b/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
@@ -308,11 +308,12 @@ class DogtagInstance(service.Service):
|
|
|
2ff659 |
doc = server_xml.getroot()
|
|
|
2ff659 |
|
|
|
2ff659 |
# no AJP connector means no need to update anything
|
|
|
2ff659 |
- connectors = doc.xpath('//Connector[@port="8009"]')
|
|
|
2ff659 |
+ connectors = doc.xpath('//Connector[@protocol="AJP/1.3"]')
|
|
|
2ff659 |
if len(connectors) == 0:
|
|
|
2ff659 |
return
|
|
|
2ff659 |
|
|
|
2ff659 |
- # AJP connector is set on port 8009. Use non-greedy search to find it
|
|
|
2ff659 |
+ # AJP protocol is at version 1.3. Assume there is only one as
|
|
|
2ff659 |
+ # Dogtag only provisions one.
|
|
|
2ff659 |
connector = connectors[0]
|
|
|
2ff659 |
|
|
|
2ff659 |
# Detect tomcat version and choose the right option name
|
|
|
2ff659 |
@@ -331,11 +332,24 @@ class DogtagInstance(service.Service):
|
|
|
2ff659 |
rewrite = False
|
|
|
2ff659 |
else:
|
|
|
2ff659 |
if oldattr in connector.attrib:
|
|
|
2ff659 |
+ # Sufficiently new Dogtag versions (10.9.0-a2) handle the
|
|
|
2ff659 |
+ # upgrade for us; we need only to ensure that we're not both
|
|
|
2ff659 |
+ # attempting to upgrade server.xml at the same time.
|
|
|
2ff659 |
+ # Hopefully this is guaranteed for us.
|
|
|
2ff659 |
self.ajp_secret = connector.attrib[oldattr]
|
|
|
2ff659 |
connector.attrib[secretattr] = self.ajp_secret
|
|
|
2ff659 |
del connector.attrib[oldattr]
|
|
|
2ff659 |
else:
|
|
|
2ff659 |
- # Generate password, don't use special chars to not break XML
|
|
|
2ff659 |
+ # Generate password, don't use special chars to not break XML.
|
|
|
2ff659 |
+ #
|
|
|
2ff659 |
+ # If we hit this case, pkispawn was run on an older Dogtag
|
|
|
2ff659 |
+ # version and we're stuck migrating, choosing a password
|
|
|
2ff659 |
+ # ourselves. Dogtag can't generate one randomly because a
|
|
|
2ff659 |
+ # Dogtag administrator might've configured AJP and might
|
|
|
2ff659 |
+ # not be using IPA.
|
|
|
2ff659 |
+ #
|
|
|
2ff659 |
+ # Newer Dogtag versions will generate a random password
|
|
|
2ff659 |
+ # during pkispawn.
|
|
|
2ff659 |
self.ajp_secret = ipautil.ipa_generate_password(special=None)
|
|
|
2ff659 |
connector.attrib[secretattr] = self.ajp_secret
|
|
|
2ff659 |
|
|
|
2ff659 |
--
|
|
|
2ff659 |
2.26.2
|
|
|
2ff659 |
|
|
|
2ff659 |
From 1e804bf19da4ee274e735fd49452d4df5d73a002 Mon Sep 17 00:00:00 2001
|
|
|
2ff659 |
From: Alexander Scheel <ascheel@redhat.com>
|
|
|
2ff659 |
Date: Wed, 17 Jun 2020 16:00:25 -0400
|
|
|
2ff659 |
Subject: [PATCH] Configure PKI AJP Secret with 256-bit secret
|
|
|
2ff659 |
|
|
|
2ff659 |
By default, PKI's AJP secret is generated as a 75-bit password. By
|
|
|
2ff659 |
generating it in IPA, we can guarantee the strength of the AJP secret.
|
|
|
2ff659 |
It makes sense to use a stronger AJP secret because it typically
|
|
|
2ff659 |
isn't rotated; access to AJP allows an attacker to impersonate an admin
|
|
|
2ff659 |
while talking to PKI.
|
|
|
2ff659 |
|
|
|
2ff659 |
Fixes: https://pagure.io/freeipa/issue/8372
|
|
|
2ff659 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1849146
|
|
|
2ff659 |
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1845447
|
|
|
2ff659 |
Related: https://github.com/dogtagpki/pki/pull/437
|
|
|
2ff659 |
|
|
|
2ff659 |
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
|
|
|
2ff659 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
2ff659 |
---
|
|
|
2ff659 |
install/share/ipaca_customize.ini | 1 +
|
|
|
2ff659 |
install/share/ipaca_default.ini | 2 ++
|
|
|
2ff659 |
ipaserver/install/dogtaginstance.py | 4 +++-
|
|
|
2ff659 |
3 files changed, 6 insertions(+), 1 deletion(-)
|
|
|
2ff659 |
|
|
|
2ff659 |
diff --git a/install/share/ipaca_customize.ini b/install/share/ipaca_customize.ini
|
|
|
2ff659 |
index 6d58579af..948734241 100644
|
|
|
2ff659 |
--- a/install/share/ipaca_customize.ini
|
|
|
2ff659 |
+++ b/install/share/ipaca_customize.ini
|
|
|
2ff659 |
@@ -12,6 +12,7 @@
|
|
|
2ff659 |
#
|
|
|
2ff659 |
# Predefined variables
|
|
|
2ff659 |
# - ipa_ca_subject
|
|
|
2ff659 |
+# - ipa_ajp_secret
|
|
|
2ff659 |
# - ipa_fqdn
|
|
|
2ff659 |
# - ipa_subject_base
|
|
|
2ff659 |
# - pki_admin_password
|
|
|
2ff659 |
diff --git a/install/share/ipaca_default.ini b/install/share/ipaca_default.ini
|
|
|
2ff659 |
index 2b9900286..a51256116 100644
|
|
|
2ff659 |
--- a/install/share/ipaca_default.ini
|
|
|
2ff659 |
+++ b/install/share/ipaca_default.ini
|
|
|
2ff659 |
@@ -12,6 +12,7 @@ ipa_ca_pem_file=/etc/ipa/ca.crt
|
|
|
2ff659 |
|
|
|
2ff659 |
## dynamic values
|
|
|
2ff659 |
# ipa_ca_subject=
|
|
|
2ff659 |
+# ipa_ajp_secret=
|
|
|
2ff659 |
# ipa_subject_base=
|
|
|
2ff659 |
# ipa_fqdn=
|
|
|
2ff659 |
# ipa_ocsp_uri=
|
|
|
2ff659 |
@@ -66,6 +67,7 @@ pki_issuing_ca=%(pki_issuing_ca_uri)s
|
|
|
2ff659 |
pki_replication_password=
|
|
|
2ff659 |
|
|
|
2ff659 |
pki_enable_proxy=True
|
|
|
2ff659 |
+pki_ajp_secret=%(ipa_ajp_secret)s
|
|
|
2ff659 |
pki_restart_configured_instance=False
|
|
|
2ff659 |
pki_security_domain_hostname=%(ipa_fqdn)s
|
|
|
2ff659 |
pki_security_domain_https_port=443
|
|
|
2ff659 |
diff --git a/ipaserver/install/dogtaginstance.py b/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
index aa3baeb7c..361d80a8c 100644
|
|
|
2ff659 |
--- a/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
+++ b/ipaserver/install/dogtaginstance.py
|
|
|
2ff659 |
@@ -840,7 +840,9 @@ class PKIIniLoader:
|
|
|
2ff659 |
pki_subsystem_type=subsystem.lower(),
|
|
|
2ff659 |
home_dir=os.path.expanduser("~"),
|
|
|
2ff659 |
# for softhsm2 testing
|
|
|
2ff659 |
- softhsm2_so=paths.LIBSOFTHSM2_SO
|
|
|
2ff659 |
+ softhsm2_so=paths.LIBSOFTHSM2_SO,
|
|
|
2ff659 |
+ # Configure a more secure AJP password by default
|
|
|
2ff659 |
+ ipa_ajp_secret=ipautil.ipa_generate_password(special=None)
|
|
|
2ff659 |
)
|
|
|
2ff659 |
|
|
|
2ff659 |
@classmethod
|
|
|
2ff659 |
--
|
|
|
2ff659 |
2.26.2
|
|
|
2ff659 |
|