Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/freeipa/freeipa
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Oct 19, 2023
2 parents 412c705 + d50624d commit 2d21692
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 34 deletions.
18 changes: 0 additions & 18 deletions install/restart_scripts/renew_ca_cert.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import shutil
import traceback

from ipalib.install import certstore
from ipapython import directivesetter
from ipapython import ipautil
from ipalib import api, errors
from ipalib import x509
Expand Down Expand Up @@ -105,23 +104,6 @@ def _main():
"Updating trust on certificate %s failed in %s" %
(nickname, db.secdir))
elif nickname == 'caSigningCert cert-pki-ca':
# Update CS.cfg
cfg_path = paths.CA_CS_CFG_PATH
config = directivesetter.get_directive(
cfg_path, 'subsystem.select', '=')
if config == 'New':
syslog.syslog(syslog.LOG_NOTICE, "Updating CS.cfg")
if cert.is_self_signed():
directivesetter.set_directive(
cfg_path, 'hierarchy.select', 'Root',
quotes=False, separator='=')
else:
directivesetter.set_directive(
cfg_path, 'hierarchy.select', 'Subordinate',
quotes=False, separator='=')
else:
syslog.syslog(syslog.LOG_NOTICE, "Not updating CS.cfg")

# Remove old external CA certificates
for ca_nick, ca_flags in db.list_certs():
if ca_flags.has_key:
Expand Down
7 changes: 5 additions & 2 deletions ipaclient/install/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3697,9 +3697,12 @@ def uninstall(options):
logger.warning(
'Some installation state has not been restored.\n'
'This may cause re-installation to fail.\n'
'It should be safe to remove /var/lib/ipa-client/sysrestore.state '
'It should be safe to remove %s '
'but it may\n mean your system hasn\'t been restored '
'to its pre-installation state.')
'to its pre-installation state.',
os.path.join(paths.IPA_CLIENT_SYSRESTORE,
sysrestore.SYSRESTORE_STATEFILE)
)

# Remove the IPA configuration file
remove_file(paths.IPA_DEFAULT_CONF)
Expand Down
2 changes: 1 addition & 1 deletion ipaserver/dcerpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def get_domain_by_sid(self, sid, exact_match=False):
# Parse sid string to see if it is really in a SID format
try:
test_sid = security.dom_sid(sid)
except TypeError:
except (TypeError, ValueError):
raise errors.ValidationError(name='sid',
error=_('SID is not valid'))

Expand Down
24 changes: 24 additions & 0 deletions ipaserver/install/cainstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ def configure_instance(self, host_name, dm_password, admin_password,
configure_lightweight_ca_acls)
self.step("Ensure lightweight CAs container exists",
ensure_lightweight_cas_container)
self.step("Enable lightweight CA monitor",
enable_lightweight_ca_monitor)
self.step(
"Ensuring backward compatibility",
self.__dogtag10_migration)
Expand Down Expand Up @@ -1783,6 +1785,28 @@ def ensure_lightweight_cas_container():
)


def enable_lightweight_ca_monitor():

# Check LWCA monitor
value = directivesetter.get_directive(
paths.CA_CS_CFG_PATH,
'ca.authorityMonitor.enable',
separator='=')

if value == 'true':
return False # already enabled; restart not needed

# Enable LWCA monitor
directivesetter.set_directive(
paths.CA_CS_CFG_PATH,
'ca.authorityMonitor.enable',
'true',
quotes=False,
separator='=')

return True # restart needed


def minimum_acme_support(data=None):
"""
ACME with global enable/disable is required.
Expand Down
14 changes: 2 additions & 12 deletions ipaserver/install/plugins/ca_renewal_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from ipalib.plugable import Registry
from ipaplatform.paths import paths
from ipapython.dn import DN
from ipapython import directivesetter

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -108,18 +107,9 @@ def execute(self, **options):
else:
logger.debug("certmonger request for RA cert not found")

config = directivesetter.get_directive(
paths.CA_CS_CFG_PATH, 'subsystem.select', '=')

if config == 'New':
pass
elif config == 'Clone':
if not ca.is_crlgen_enabled():
# CA is not a renewal master
return False, []
else:
logger.warning(
"CS.cfg has unknown subsystem.select value '%s', "
"assuming local CA is not a renewal master", config)
return (False, False, [])

update = {
'dn': dn,
Expand Down
11 changes: 11 additions & 0 deletions ipaserver/install/server/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,16 @@ def ca_ensure_lightweight_cas_container(ca):
return cainstance.ensure_lightweight_cas_container()


def ca_enable_lightweight_ca_monitor(ca):
logger.info('[Enabling LWCA monitor]')

if not ca.is_configured():
logger.info('CA is not configured')
return False

return cainstance.enable_lightweight_ca_monitor()


def ca_add_default_ocsp_uri(ca):
logger.info('[Adding default OCSP URI configuration]')
if not ca.is_configured():
Expand Down Expand Up @@ -1904,6 +1914,7 @@ def upgrade_configuration():
ca_configure_profiles_acl(ca),
ca_configure_lightweight_ca_acls(ca),
ca_ensure_lightweight_cas_container(ca),
ca_enable_lightweight_ca_monitor(ca),
ca_add_default_ocsp_uri(ca),
ca_disable_publish_cert(ca),
])
Expand Down
4 changes: 3 additions & 1 deletion ipatests/test_integration/test_epn.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def configure_starttls(host):
postconf(host, 'smtpd_tls_session_cache_timeout = 3600s')
# announce STARTTLS support to remote SMTP clients, not require
postconf(host, 'smtpd_tls_security_level = may')

host.run_command(["systemctl", "restart", "postfix"])


Expand Down Expand Up @@ -208,6 +207,9 @@ def configure_ssl_client_cert(host):
# CA certificates of root CAs trusted to sign remote SMTP client cert
postconf(host, f"smtpd_tls_CAfile = {paths.IPA_CA_CRT}")

if host.is_fips_mode:
postconf(host, 'smtpd_tls_fingerprint_digest = sha256')

host.run_command(["systemctl", "restart", "postfix"])


Expand Down
2 changes: 2 additions & 0 deletions ipatests/test_integration/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ipatests.test_integration.base import IntegrationTest
from ipatests.test_integration.test_caless import CALessBase, ipa_certs_cleanup
from ipatests.test_integration.test_cert import get_certmonger_fs_id
from ipatests.pytest_ipa.integration import skip_if_fips
from ipaplatform import services


Expand Down Expand Up @@ -298,6 +299,7 @@ def test_replica_ca_install_with_skip_schema_check(self):
tasks.install_replica(self.master, self.replicas[1], setup_ca=False)
tasks.install_ca(self.replicas[1], extra_args=["--skip-schema-check"])

@skip_if_fips()
def test_certmonger_reads_token_HSM(self):
"""Test if certmonger reads the token in HSM
Expand Down

0 comments on commit 2d21692

Please sign in to comment.