Replace /etc/ipa/ipa.conf with /etc/ipa/default.conf

The new framework uses default.conf instead of ipa.conf. This is useful
also because Apache uses a configuration file named ipa.conf.

This wipes out the last vestiges of the old ipa.conf from v1.
This commit is contained in:
Rob Crittenden 2009-11-25 17:16:06 -05:00 committed by Jason Gerard DeRose
parent 2f8129a17c
commit 384eec771d
7 changed files with 24 additions and 37 deletions

View File

@ -269,14 +269,14 @@ def main():
opts = [{'name':'comment', 'type':'comment', 'value':'File modified by ipa-client-install'}, opts = [{'name':'comment', 'type':'comment', 'value':'File modified by ipa-client-install'},
{'name':'empty', 'type':'empty'}] {'name':'empty', 'type':'empty'}]
#[defaults] #[global]
defopts = [{'name':'server', 'type':'option', 'value':ipasrv.getServerName()}, defopts = [{'name':'xmlrpc_uri', 'type':'option', 'value':'https://%s/ipa/xml' % ipasrv.getServerName()},
{'name':'realm', 'type':'option', 'value':ipasrv.getRealmName()}] {'name':'realm', 'type':'option', 'value':ipasrv.getRealmName()}]
opts.append({'name':'defaults', 'type':'section', 'value':defopts}) opts.append({'name':'global', 'type':'section', 'value':defopts})
opts.append({'name':'empty', 'type':'empty'}) opts.append({'name':'empty', 'type':'empty'})
ipaconf.newConf("/etc/ipa/ipa.conf", opts) ipaconf.newConf("/etc/ipa/default.conf", opts)
# Configure ldap.conf # Configure ldap.conf
ldapconf = ipachangeconf.IPAChangeConf("IPA Installer") ldapconf = ipachangeconf.IPAChangeConf("IPA Installer")

View File

@ -349,14 +349,6 @@ def main():
CA.fix_ra_perms() CA.fix_ra_perms()
service.restart("httpd") service.restart("httpd")
# Create the config file
fd = open("/etc/ipa/ipa.conf", "w")
fd.write("[defaults]\n")
fd.write("server=" + config.host_name + "\n")
fd.write("realm=" + config.realm_name + "\n")
fd.write("domain=" + config.domain_name + "\n")
fd.close()
# Create the management framework config file # Create the management framework config file
fd = open("/etc/ipa/default.conf", "w") fd = open("/etc/ipa/default.conf", "w")
fd.write("[global]\n") fd.write("[global]\n")

View File

@ -751,15 +751,6 @@ def main():
http.create_instance(realm_name, host_name, domain_name, autoconfig=True, self_signed_ca=not options.ca) http.create_instance(realm_name, host_name, domain_name, autoconfig=True, self_signed_ca=not options.ca)
ipautil.run(["/sbin/restorecon", "/var/cache/ipa/sessions"]) ipautil.run(["/sbin/restorecon", "/var/cache/ipa/sessions"])
# Create the config file
fstore.backup_file("/etc/ipa/ipa.conf")
fd = open("/etc/ipa/ipa.conf", "w")
fd.write("[defaults]\n")
fd.write("server=" + host_name + "\n")
fd.write("realm=" + realm_name + "\n")
fd.write("domain=" + domain_name + "\n")
fd.close()
# Create the management framework config file # Create the management framework config file
fstore.backup_file("/etc/ipa/default.conf") fstore.backup_file("/etc/ipa/default.conf")
fd = open("/etc/ipa/default.conf", "w") fd = open("/etc/ipa/default.conf", "w")

View File

@ -270,7 +270,7 @@ ln -s ../../../..%{_sysconfdir}/ipa/html/unauthorized.html \
# So we can own our Apache configuration # So we can own our Apache configuration
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ipa/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ipa/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/
/bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/ipa/ipa.conf /bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/ipa/default.conf
/bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ipa.conf /bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ipa.conf
/bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf /bin/touch $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf
%endif %endif
@ -386,7 +386,7 @@ fi
%dir %{_sysconfdir}/ipa/html %dir %{_sysconfdir}/ipa/html
%config(noreplace) %{_sysconfdir}/ipa/html/ssbrowser.html %config(noreplace) %{_sysconfdir}/ipa/html/ssbrowser.html
%config(noreplace) %{_sysconfdir}/ipa/html/unauthorized.html %config(noreplace) %{_sysconfdir}/ipa/html/unauthorized.html
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/ipa.conf %ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/default.conf
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf %ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/httpd/conf.d/ipa.conf %ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/httpd/conf.d/ipa.conf
%{_usr}/share/ipa/ipa.conf %{_usr}/share/ipa/ipa.conf
@ -460,7 +460,7 @@ fi
%{python_sitelib}/ipapython-*.egg-info %{python_sitelib}/ipapython-*.egg-info
%{python_sitelib}/freeipa-*.egg-info %{python_sitelib}/freeipa-*.egg-info
%endif %endif
%config(noreplace) %{_sysconfdir}/ipa/ipa.conf %config(noreplace) %{_sysconfdir}/ipa/default.conf
%if %{WITH_RADIUS} %if %{WITH_RADIUS}
%files radius-server %files radius-server
@ -482,6 +482,9 @@ fi
%endif %endif
%changelog %changelog
* Wed Nov 25 2009 Rob Crittenden <rcritten@redhat.com> - 1.99-11
- Remove v1-style /etc/ipa/ipa.conf, replacing with /etc/ipa/default.conf
* Fri Nov 13 2009 Rob Crittenden <rcritten@redhat.com> - 1.99-10 * Fri Nov 13 2009 Rob Crittenden <rcritten@redhat.com> - 1.99-10
- Add bash completion script and own /etc/bash_completion.d in case it - Add bash completion script and own /etc/bash_completion.d in case it
doesn't already exist doesn't already exist

View File

@ -5,7 +5,7 @@ A brief overview:
config.py - identify the IPA server domain and realm. It uses dnsclient to config.py - identify the IPA server domain and realm. It uses dnsclient to
try to detect this information first and will fall back to try to detect this information first and will fall back to
/etc/ipa/ipa.conf if that fails. /etc/ipa/default.conf if that fails.
dnsclient.py - find IPA information via DNS dnsclient.py - find IPA information via DNS
ipautil.py - helper functions ipautil.py - helper functions

View File

@ -24,6 +24,7 @@ import krbV
import socket import socket
import ipapython.dnsclient import ipapython.dnsclient
import re import re
import urlparse
class IPAConfigError(Exception): class IPAConfigError(Exception):
def __init__(self, msg=''): def __init__(self, msg=''):
@ -88,22 +89,23 @@ config = IPAConfig()
def __parse_config(discover_server = True): def __parse_config(discover_server = True):
p = ConfigParser.SafeConfigParser() p = ConfigParser.SafeConfigParser()
p.read("/etc/ipa/ipa.conf") p.read("/etc/ipa/default.conf")
try: try:
if not config.default_realm: if not config.default_realm:
config.default_realm = p.get("defaults", "realm") config.default_realm = p.get("global", "realm")
except: except:
pass pass
if discover_server: if discover_server:
try: try:
s = p.get("defaults", "server") s = p.get("global", "xmlrpc_uri")
config.default_server.extend(re.sub("\s+", "", s).split(',')) server = urlparse.urlsplit(s)
config.default_server.extend(server.netloc)
except: except:
pass pass
try: try:
if not config.default_domain: if not config.default_domain:
config.default_domain = p.get("defaults", "domain") config.default_domain = p.get("global", "domain")
except: except:
pass pass
@ -128,7 +130,7 @@ def __discover_config(discover_server = True):
while rl == 0: while rl == 0:
tok = dom_name.find(".") tok = dom_name.find(".")
if tok == -1: if tok == -1:
return False return False
dom_name = dom_name[tok+1:] dom_name = dom_name[tok+1:]
name = "_ldap._tcp." + dom_name + "." name = "_ldap._tcp." + dom_name + "."
rs = ipapython.dnsclient.query(name, ipapython.dnsclient.DNS_C_IN, ipapython.dnsclient.DNS_T_SRV) rs = ipapython.dnsclient.query(name, ipapython.dnsclient.DNS_C_IN, ipapython.dnsclient.DNS_T_SRV)
@ -138,8 +140,8 @@ def __discover_config(discover_server = True):
if discover_server: if discover_server:
if rl == 0: if rl == 0:
name = "_ldap._tcp."+config.default_domain+"." name = "_ldap._tcp."+config.default_domain+"."
rs = ipapython.dnsclient.query(name, ipapython.dnsclient.DNS_C_IN, ipapython.dnsclient.DNS_T_SRV) rs = ipapython.dnsclient.query(name, ipapython.dnsclient.DNS_C_IN, ipapython.dnsclient.DNS_T_SRV)
for r in rs: for r in rs:
if r.dns_type == ipapython.dnsclient.DNS_T_SRV: if r.dns_type == ipapython.dnsclient.DNS_T_SRV:
@ -176,8 +178,8 @@ def init_config(options=None):
config.default_server = new_server config.default_server = new_server
if not config.default_realm: if not config.default_realm:
raise IPAConfigError("IPA realm not found in DNS, in the config file (/etc/ipa/ipa.conf) or on the command line.") raise IPAConfigError("IPA realm not found in DNS, in the config file (/etc/ipa/default.conf) or on the command line.")
if not config.default_server: if not config.default_server:
raise IPAConfigError("IPA server not found in DNS, in the config file (/etc/ipa/ipa.conf) or on the command line.") raise IPAConfigError("IPA server not found in DNS, in the config file (/etc/ipa/default.conf) or on the command line.")
if not config.default_domain: if not config.default_domain:
raise IPAConfigError("IPA domain not found in the config file (/etc/ipa/ipa.conf) or on the command line.") raise IPAConfigError("IPA domain not found in the config file (/etc/ipa/default.conf) or on the command line.")

View File

@ -66,7 +66,6 @@ def setup_package():
platforms = ["Linux", "Solaris", "Unix"], platforms = ["Linux", "Solaris", "Unix"],
package_dir = {'ipapython': ''}, package_dir = {'ipapython': ''},
packages = [ "ipapython" ], packages = [ "ipapython" ],
data_files = [('/etc/ipa', ['ipa.conf'])]
) )
finally: finally:
del sys.path[0] del sys.path[0]