Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable OCSP direct pushing during upgrade #4436

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions base/server/upgrade/10.13.6/01-DisableOCSPDirectPublishing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Authors:
# Marco Fargetta <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright (C) 2023 Red Hat, Inc.

import fileinput
import os
import re
import pki.server.upgrade


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

def __init__(self):
super(DisableOCSPDirectPublishing, self).__init__()
self.message = 'Disable direct publishing to the OCSP instance'

def upgrade_subsystem(self, instance, subsystem):

if subsystem.name != 'ca':
return

cs_cfg = os.path.join(
instance.base_dir,
'conf',
subsystem.name,
'CS.cfg')

self.backup(cs_cfg)

for line in fileinput.input(cs_cfg, inplace=1):
line = re.sub(r'^ca.publish.rule.instance.ocsprule-(.*).enable=.*',
r'ca.publish.rule.instance.ocsprule-\1.enable=false',
line)

print(line, end='')

os.chown(cs_cfg, instance.uid, instance.gid)