summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinstall/tools/ipa-ca-install2
-rwxr-xr-xinstall/tools/ipa-replica-install3
-rwxr-xr-xinstall/tools/ipa-server-install8
-rwxr-xr-xinstall/tools/ipa-upgradeconfig6
-rwxr-xr-xinstall/tools/ipactl4
-rw-r--r--ipaserver/install/adtrustinstance.py3
-rw-r--r--ipaserver/install/bindinstance.py3
-rw-r--r--ipaserver/install/cainstance.py2
-rw-r--r--ipaserver/install/dsinstance.py9
-rw-r--r--ipaserver/install/installutils.py3
-rw-r--r--ipaserver/install/ipa_backup.py19
-rw-r--r--ipaserver/install/ipa_replica_prepare.py2
-rw-r--r--ipaserver/install/ipa_restore.py9
-rw-r--r--ipaserver/install/ipa_server_certinstall.py2
-rw-r--r--ipaserver/install/krbinstance.py2
-rw-r--r--ipaserver/install/upgradeinstance.py3
16 files changed, 43 insertions, 37 deletions
diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install
index 6f8ff880b..f087d2d6a 100755
--- a/install/tools/ipa-ca-install
+++ b/install/tools/ipa-ca-install
@@ -284,7 +284,7 @@ def install_master(safe_options, options):
check_ca()
dirname = dsinstance.config_dirname(
- dsinstance.realm_to_serverid(realm_name))
+ installutils.realm_to_serverid(realm_name))
cadb = certs.CertDB(realm_name, subject_base=subject_base)
dsdb = certs.CertDB(realm_name, nssdir=dirname, subject_base=subject_base)
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index 86931293f..b09a5f16e 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -544,7 +544,8 @@ def main():
fd.write("realm=%s\n" % config.realm_name)
fd.write("domain=%s\n" % config.domain_name)
fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % ipautil.format_netloc(config.host_name))
- fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % dsinstance.realm_to_serverid(config.realm_name))
+ fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" %
+ installutils.realm_to_serverid(config.realm_name))
if ipautil.file_exists(config.dir + "/cacert.p12"):
fd.write("enable_ra=True\n")
fd.write("ra_plugin=dogtag\n")
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 56a43770d..1fe5bd9ea 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -655,7 +655,8 @@ def uninstall():
'mean your system hasn\'t be restored to its pre-installation state.' % SYSRESTORE_DIR_PATH)
# Note that this name will be wrong after the first uninstall.
- dirname = dsinstance.config_dirname(dsinstance.realm_to_serverid(api.env.realm))
+ dirname = dsinstance.config_dirname(
+ installutils.realm_to_serverid(api.env.realm))
dirs = [dirname, dogtag_constants.ALIAS_DIR, certs.NSS_DIR]
ids = certmonger.check_state(dirs)
if ids:
@@ -666,7 +667,7 @@ def uninstall():
def set_subject_in_config(realm_name, dm_password, suffix, subject_base):
ldapuri = 'ldapi://%%2fvar%%2frun%%2fslapd-%s.socket' % (
- dsinstance.realm_to_serverid(realm_name)
+ installutils.realm_to_serverid(realm_name)
)
try:
conn = ldap2(shared_instance=False, ldap_uri=ldapuri, base_dn=suffix)
@@ -1134,7 +1135,8 @@ def main():
fd.write("realm=%s\n" % realm_name)
fd.write("domain=%s\n" % domain_name)
fd.write("xmlrpc_uri=https://%s/ipa/xml\n" % format_netloc(host_name))
- fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" % dsinstance.realm_to_serverid(realm_name))
+ fd.write("ldap_uri=ldapi://%%2fvar%%2frun%%2fslapd-%s.socket\n" %
+ installutils.realm_to_serverid(realm_name))
if setup_ca:
fd.write("enable_ra=True\n")
fd.write("ra_plugin=dogtag\n")
diff --git a/install/tools/ipa-upgradeconfig b/install/tools/ipa-upgradeconfig
index 8159ce244..dfef1e0aa 100755
--- a/install/tools/ipa-upgradeconfig
+++ b/install/tools/ipa-upgradeconfig
@@ -1132,7 +1132,7 @@ def fix_schema_file_syntax():
root_logger.info('Syntax already fixed')
return
- serverid = dsinstance.realm_to_serverid(api.env.realm)
+ serverid = installutils.realm_to_serverid(api.env.realm)
ds_dir = dsinstance.config_dirname(serverid)
# 1. 60ipadns.ldif: Add parenthesis to idnsRecord
@@ -1191,7 +1191,7 @@ def remove_ds_ra_cert(subject_base):
return
dbdir = dsinstance.config_dirname(
- dsinstance.realm_to_serverid(api.env.realm))
+ installutils.realm_to_serverid(api.env.realm))
dsdb = certs.CertDB(api.env.realm, nssdir=dbdir, subject_base=subject_base)
nickname = 'CN=IPA RA,%s' % subject_base
@@ -1309,7 +1309,7 @@ def main():
'ca.crl.MasterCRL.enableCRLUpdates', '=')
sub_dict['CLONE']='#' if crl.lower() == 'true' else ''
- ds_serverid = dsinstance.realm_to_serverid(api.env.realm)
+ ds_serverid = installutils.realm_to_serverid(api.env.realm)
ds_dirname = dsinstance.config_dirname(ds_serverid)
upgrade(sub_dict, paths.HTTPD_IPA_CONF, ipautil.SHARE_DIR + "ipa.conf")
diff --git a/install/tools/ipactl b/install/tools/ipactl
index b37f55575..52dfe67dd 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -25,7 +25,7 @@ import json
import ldapurl
from ipaserver.install import service, installutils
-from ipaserver.install.dsinstance import config_dirname, realm_to_serverid
+from ipaserver.install.dsinstance import config_dirname
from ipaserver.install.installutils import is_ipa_configured, ScriptError
from ipalib import api, errors
from ipapython.ipaldap import IPAdmin
@@ -53,7 +53,7 @@ def is_dirsrv_debugging_enabled():
returns True or False
"""
debugging = False
- serverid = realm_to_serverid(api.env.realm)
+ serverid = installutils.realm_to_serverid(api.env.realm)
dselist = [config_dirname(serverid)]
for dse in dselist:
try:
diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index 92c05f26a..8591a434a 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -28,7 +28,6 @@ import re
from ipaserver.install import service
from ipaserver.install import installutils
-from ipaserver.install.dsinstance import realm_to_serverid
from ipaserver.install.bindinstance import get_rr, add_rr, del_rr, \
dns_zone_exists
from ipalib import errors, api
@@ -155,7 +154,7 @@ class ADTRUSTInstance(service.Service):
self.cifs_principal = "cifs/" + self.fqdn + "@" + self.realm
self.suffix = ipautil.realm_to_suffix(self.realm)
self.ldapi_socket = "%%2fvar%%2frun%%2fslapd-%s.socket" % \
- realm_to_serverid(self.realm)
+ installutils.realm_to_serverid(self.realm)
# DN definitions
self.trust_dn = DN(api.env.container_trusts, self.suffix)
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 97dcb3d95..4c1bfa600 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -30,7 +30,6 @@ import ldap
import installutils
import service
from ipaserver.plugins import ldap2
-from ipaserver.install.dsinstance import realm_to_serverid
from ipaserver.install.cainstance import IPA_CA_RECORD
from ipapython import sysrestore, ipautil, ipaldap
from ipapython.ipa_log_manager import *
@@ -727,7 +726,7 @@ class BindInstance(service.Service):
DOMAIN=self.domain,
HOST=self.host,
REALM=self.realm,
- SERVER_ID=realm_to_serverid(self.realm),
+ SERVER_ID=installutils.realm_to_serverid(self.realm),
FORWARDERS=fwds,
SUFFIX=self.suffix,
OPTIONAL_NTP=optional_ntp,
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index 8ccfd1a82..7ba992bef 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -1771,7 +1771,7 @@ def update_people_entry(dercert):
issuer = x509.get_issuer(dercert, datatype=x509.DER)
attempts = 0
- server_id = dsinstance.realm_to_serverid(api.env.realm)
+ server_id = installutils.realm_to_serverid(api.env.realm)
dogtag_uri = 'ldapi://%%2fvar%%2frun%%2fslapd-%s.socket' % server_id
updated = False
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index da00bcf82..52df6b7de 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -73,9 +73,6 @@ def find_server_root():
else:
return paths.USR_LIB_DIRSRV
-def realm_to_serverid(realm_name):
- return "-".join(realm_name.split("."))
-
def config_dirname(serverid):
return (paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % serverid) + "/"
@@ -266,7 +263,7 @@ class DsInstance(service.Service):
def init_info(self, realm_name, fqdn, domain_name, dm_password,
subject_base, idstart, idmax, pkcs12_info, ca_file=None):
self.realm = realm_name.upper()
- self.serverid = realm_to_serverid(self.realm)
+ self.serverid = installutils.realm_to_serverid(self.realm)
self.suffix = ipautil.realm_to_suffix(self.realm)
self.fqdn = fqdn
self.dm_password = dm_password
@@ -844,7 +841,7 @@ class DsInstance(service.Service):
# shutdown the server
self.stop()
- dirname = config_dirname(realm_to_serverid(self.realm))
+ dirname = config_dirname(installutils.realm_to_serverid(self.realm))
certdb = certs.CertDB(self.realm, nssdir=dirname, subject_base=self.subject_base)
if not cacert_name or len(cacert_name) == 0:
cacert_name = "Imported CA"
@@ -981,7 +978,7 @@ class DsInstance(service.Service):
'certmap.conf')
certmap_dir = config_dirname(
- realm_to_serverid(api.env.realm)
+ installutils.realm_to_serverid(api.env.realm)
)
try:
with open(os.path.join(certmap_dir, 'certmap.conf')) as f:
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 8a4f2cada..dc41c0f87 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -1105,3 +1105,6 @@ def check_version():
)
else:
raise UpgradeMissingVersionError("no data_version stored")
+
+def realm_to_serverid(realm_name):
+ return "-".join(realm_name.split("."))
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
index 9771f8ae3..c3611b241 100644
--- a/ipaserver/install/ipa_backup.py
+++ b/ipaserver/install/ipa_backup.py
@@ -34,7 +34,7 @@ from ipapython.ipautil import run, write_tmp_file
from ipapython import admintool
from ipapython.config import IPAOptionParser
from ipapython.dn import DN
-from ipaserver.install.dsinstance import realm_to_serverid, DS_USER
+from ipaserver.install.dsinstance import DS_USER
from ipaserver.install.replication import wait_for_task
from ipaserver.install import installutils
from ipapython import ipaldap
@@ -290,7 +290,9 @@ class Backup(admintool.AdminTool):
self.log.info('Stopping IPA services')
run(['ipactl', 'stop'])
- for instance in [realm_to_serverid(api.env.realm), 'PKI-IPA']:
+ for instance in [
+ installutils.realm_to_serverid(api.env.realm), 'PKI-IPA'
+ ]:
if os.path.exists(paths.VAR_LIB_SLAPD_INSTANCE_DIR_TEMPLATE % instance):
if os.path.exists(paths.SLAPD_INSTANCE_DB_DIR_TEMPLATE % (instance, 'ipaca')):
self.db2ldif(instance, 'ipaca', online=options.online)
@@ -323,10 +325,12 @@ class Backup(admintool.AdminTool):
NOTE: this adds some things that may not get backed up, like the PKI-IPA
instance.
'''
+ serverid = installutils.realm_to_serverid(api.env.realm)
+
for dir in [
- paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % realm_to_serverid(api.env.realm),
- paths.VAR_LIB_DIRSRV_INSTANCE_SCRIPTS_TEMPLATE % realm_to_serverid(api.env.realm),
- paths.VAR_LIB_SLAPD_INSTANCE_DIR_TEMPLATE % realm_to_serverid(api.env.realm),
+ paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % serverid,
+ paths.VAR_LIB_DIRSRV_INSTANCE_SCRIPTS_TEMPLATE % serverid,
+ paths.VAR_LIB_SLAPD_INSTANCE_DIR_TEMPLATE % serverid,
paths.VAR_LIB_SLAPD_PKI_IPA_DIR_TEMPLATE,
paths.USR_LIB_SLAPD_PKI_IPA_DIR,
paths.ETC_SLAPD_PKI_IPA_DIR,
@@ -337,13 +341,14 @@ class Backup(admintool.AdminTool):
self.dirs.append(dir)
for file in [
- paths.SYSCONFIG_DIRSRV_INSTANCE % realm_to_serverid(api.env.realm),
+ paths.SYSCONFIG_DIRSRV_INSTANCE % serverid,
paths.SYSCONFIG_DIRSRV_PKI_IPA_DIR]:
if os.path.exists(file):
self.files.append(file)
for log in [
- paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % realm_to_serverid(api.env.realm),]:
+ paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % serverid,
+ ]:
self.logs.append(log)
diff --git a/ipaserver/install/ipa_replica_prepare.py b/ipaserver/install/ipa_replica_prepare.py
index 79fdf2f50..a66b39d6f 100644
--- a/ipaserver/install/ipa_replica_prepare.py
+++ b/ipaserver/install/ipa_replica_prepare.py
@@ -162,7 +162,7 @@ class ReplicaPrepare(admintool.AdminTool):
raise admintool.ScriptError("You can't create a replica on itself")
config_dir = dsinstance.config_dirname(
- dsinstance.realm_to_serverid(api.env.realm))
+ installutils.realm_to_serverid(api.env.realm))
if not ipautil.dir_exists(config_dir):
raise admintool.ScriptError(
"could not find directory instance: %s" % config_dir)
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
index b5caad240..cc466c204 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -32,8 +32,7 @@ from ipapython import version, ipautil, certdb, dogtag
from ipapython.ipautil import run, user_input
from ipapython import admintool
from ipapython.dn import DN
-from ipaserver.install.dsinstance import (realm_to_serverid,
- create_ds_user, DS_USER)
+from ipaserver.install.dsinstance import create_ds_user, DS_USER
from ipaserver.install.cainstance import PKI_USER, create_ca_user
from ipaserver.install.replication import (wait_for_task, ReplicationManager,
get_cs_replication_manager)
@@ -791,7 +790,7 @@ class Restore(admintool.AdminTool):
httpinstance.HTTPInstance().stop_tracking_certificates()
try:
dsinstance.DsInstance().stop_tracking_certificates(
- realm_to_serverid(api.env.realm))
+ installutils.realm_to_serverid(api.env.realm))
except OSError:
# When IPA is not installed, DS NSS DB does not exist
pass
@@ -832,5 +831,7 @@ class Restore(admintool.AdminTool):
api.bootstrap(in_server=False, context='restore', **overrides)
api.finalize()
- self.instances = [realm_to_serverid(api.env.realm), 'PKI-IPA']
+ self.instances = [
+ installutils.realm_to_serverid(api.env.realm), 'PKI-IPA'
+ ]
self.backends = ['userRoot', 'ipaca']
diff --git a/ipaserver/install/ipa_server_certinstall.py b/ipaserver/install/ipa_server_certinstall.py
index 80cf6d5d5..9e24c4ce0 100644
--- a/ipaserver/install/ipa_server_certinstall.py
+++ b/ipaserver/install/ipa_server_certinstall.py
@@ -114,7 +114,7 @@ class ServerCertInstall(admintool.AdminTool):
conn.disconnect()
def install_dirsrv_cert(self):
- serverid = dsinstance.realm_to_serverid(api.env.realm)
+ serverid = installutils.realm_to_serverid(api.env.realm)
dirname = dsinstance.config_dirname(serverid)
conn = api.Backend.ldap2
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index 266adb33b..154dbea72 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -235,7 +235,7 @@ class KrbInstance(service.Service):
SUFFIX=self.suffix,
DOMAIN=self.domain,
HOST=self.host,
- SERVER_ID=dsinstance.realm_to_serverid(self.realm),
+ SERVER_ID=installutils.realm_to_serverid(self.realm),
REALM=self.realm)
# IPA server/KDC is not a subdomain of default domain
diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py
index 160b735c8..08d5e91fb 100644
--- a/ipaserver/install/upgradeinstance.py
+++ b/ipaserver/install/upgradeinstance.py
@@ -26,7 +26,6 @@ from ipaplatform.paths import paths
from ipapython.ipa_log_manager import *
from ipaserver.install import installutils
-from ipaserver.install import dsinstance
from ipaserver.install import schemaupdate
from ipaserver.install import ldapupdate
from ipaserver.install import service
@@ -51,7 +50,7 @@ class IPAUpgrade(service.Service):
h = "%02x" % rand.randint(0,255)
ext += h
service.Service.__init__(self, "dirsrv")
- serverid = dsinstance.realm_to_serverid(realm_name)
+ serverid = installutils.realm_to_serverid(realm_name)
self.filename = '%s/%s' % (paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % serverid, DSE)
self.savefilename = '%s/%s.ipa.%s' % (paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % serverid, DSE, ext)
self.files = files