pkispawn: override AJP connector address

Since commit 1906afbeb3c8b7140601be7f9bee2f7fef5b0a5e, in order to fix
rhbz#1780082, pki defines AJP connectors using localhost4 and localhost6:
  <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" address="localhost4" name="Connector1" secret="..."/>
  <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" address="localhost6" name="Connector2" secret="..."/>

When /etc/hosts only defines the following:
    127.0.0.1 localhost
    ::1 localhost
the connector initialization may fail with
    java.net.BindException: Address already in use

The installer can add the following definitions to pkispawn cfg file:
    pki_ajp_host_ipv4=127.0.0.1
    pki_ajp_host_ipv6=::1
in order to force the value to an IP address instead of localhost4/6.

Fixes: https://pagure.io/freeipa/issue/8851
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2021-05-06 12:02:03 +02:00 committed by Alexander Bokovoy
parent 10461b7091
commit 379d5da0ae

View File

@ -537,6 +537,11 @@ class CAInstance(DogtagInstance):
if os.path.exists(paths.IPA_CA_CRT):
cfg['pki_cert_chain_path'] = paths.IPA_CA_CRT
# Use IP address instead of default localhost4 and localhost6
# because /etc/hosts does not always define them
cfg['pki_ajp_host_ipv4'] = "127.0.0.1"
cfg['pki_ajp_host_ipv6'] = "::1"
if self.clone:
if self.no_db_setup:
cfg.update(