Skip to content

Commit

Permalink
Update script for plicy password contraint
Browse files Browse the repository at this point in the history
The update add the policy password contraint to the registry but it does
not modify the current profiles policies.
  • Loading branch information
fmarco76 committed Feb 10, 2025
1 parent fc70cfc commit 72aaadf
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright Red Hat, Inc.
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import pki.server.upgrade


class ConfigurePasswordPolicyConstraints(pki.server.upgrade.PKIServerUpgradeScriptlet):

def __init__(self):
super().__init__()
self.message = 'Configure PKCS12 Password constraints policy'

def upgrade_subsystem(self, instance, subsystem):

if subsystem.name != 'ca':
return

self.backup(subsystem.registry_conf)

policy_ids = subsystem.registry.get('constraintPolicy.ids')
subsystem.registry['constraintPolicy.ids'] = \
','.join([policy_ids, 'p12ExportPasswordConstraintImpl'])
subsystem.registry['constraintPolicy.p12ExportPasswordConstraintImpl.class'] = \
'com.netscape.cms.profile.constraint.P12ExportPasswordConstraint'
subsystem.registry['constraintPolicy.p12ExportPasswordConstraintImpl.desc'] = \
'Generated PKCS12 Constraint'
subsystem.registry['constraintPolicy.p12ExportPasswordConstraintImpl.name'] = \
'Generated PKCS12 Constraint'

subsystem.save()

0 comments on commit 72aaadf

Please sign in to comment.