forked from dogtagpki/pki
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added upgrade script for ACME server cert profile
The ACME server cert profile (acmeServerCert.cfg) has been moved into /usr/share/pki/ca/profiles/ca such that it will be included in new CA installations. An upgrade script has been added to deploy the profile into existing instances and update the CS.cfg when the server is restarted.
- Loading branch information
Showing
4 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Authors: | ||
# Endi S. Dewata <edewata@redhat.com> | ||
# | ||
# Copyright Red Hat, Inc. | ||
# | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
from __future__ import absolute_import | ||
import logging | ||
import os | ||
|
||
import pki | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class AddACMEServerCertProfile(pki.server.upgrade.PKIServerUpgradeScriptlet): | ||
|
||
def __init__(self): | ||
super(AddACMEServerCertProfile, self).__init__() | ||
self.message = 'Add acmeServerCert profile' | ||
|
||
def upgrade_subsystem(self, instance, subsystem): | ||
|
||
if subsystem.name != 'ca': | ||
return | ||
|
||
path = os.path.join(subsystem.base_dir, 'profiles', 'ca', 'acmeServerCert.cfg') | ||
|
||
if not os.path.exists(path): | ||
logger.info('Creating acmeServerCert.cfg') | ||
self.backup(path) | ||
instance.copyfile('/usr/share/pki/ca/profiles/ca/acmeServerCert.cfg', path) | ||
|
||
logger.info('Adding acmeServerCert into profile.list') | ||
profile_list = subsystem.config.get('profile.list').split(',') | ||
if 'acmeServerCert' not in profile_list: | ||
profile_list.append('acmeServerCert') | ||
profile_list.sort() | ||
subsystem.config['profile.list'] = ','.join(profile_list) | ||
|
||
logger.info('Adding profile.acmeServerCert.class_id') | ||
subsystem.config['profile.acmeServerCert.class_id'] = 'caEnrollImpl' | ||
|
||
logger.info('Adding profile.acmeServerCert.config') | ||
subsystem.config['profile.acmeServerCert.config'] = path | ||
|
||
self.backup(subsystem.cs_conf) | ||
subsystem.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters