#! /usr/bin/python -E # Authors: Karl MacMillan # # Copyright (C) 2007 Red Hat # see file 'COPYING' for use and warranty information # # 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 only # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # requires the following packages: # fedora-ds-base # openldap-clients # nss-tools VERSION = "%prog .1" import logging from optparse import OptionParser import ipa.dsinstance import ipa.krbinstance def parse_options(): parser = OptionParser(version=VERSION) parser.add_option("-r", "--realm", dest="realm_name", help="realm name") parser.add_option("-a", "--host-address", dest="host_name", help="host address (name or IP address)") parser.add_option("-p", "--password", dest="password", help="admin password") parser.add_option("-m", "--master-password", dest="master_password", help="kerberos master password") options, args = parser.parse_args() if not options.realm_name or not options.host_name or not options.password: parser.error("error: password, realm, and host name required") return options def main(): logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='ipa-install.log', filemode='w') options = parse_options() ds = ipa.dsinstance.DsInstance() ds.create_instance(options.realm_name, options.host_name, options.password) krb = ipa.krbinstance.KrbInstance() krb.create_instance(options.realm_name, options.host_name, options.password, options.master_password) #restart ds after the krb instance have add the sasl map ds.restart() return 0 main()