mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add local-dist target.
Remove hard-coded config.
This commit is contained in:
19
Makefile
19
Makefile
@@ -53,10 +53,20 @@ version-update:
|
|||||||
> ipa-python/freeipa-python.spec
|
> ipa-python/freeipa-python.spec
|
||||||
|
|
||||||
|
|
||||||
tarballs:
|
archive:
|
||||||
-mkdir -p dist
|
-mkdir -p dist
|
||||||
hg archive -t files dist/freeipa
|
hg archive -t files dist/freeipa
|
||||||
|
|
||||||
|
local-archive:
|
||||||
|
-mkdir -p dist/freeipa
|
||||||
|
@for subdir in $(SUBDIRS); do \
|
||||||
|
cp -pr $$subdir dist/freeipa/.; \
|
||||||
|
done
|
||||||
|
|
||||||
|
archive-cleanup:
|
||||||
|
rm -fr dist/freeipa
|
||||||
|
|
||||||
|
tarballs:
|
||||||
# ipa-server
|
# ipa-server
|
||||||
mv dist/freeipa/ipa-server dist/$(SERV_TARBALL_PREFIX)
|
mv dist/freeipa/ipa-server dist/$(SERV_TARBALL_PREFIX)
|
||||||
rm -f dist/$(SERV_TARBALL)
|
rm -f dist/$(SERV_TARBALL)
|
||||||
@@ -75,9 +85,6 @@ tarballs:
|
|||||||
cd dist; tar cfz $(PYTHON_TARBALL) $(PYTHON_TARBALL_PREFIX)
|
cd dist; tar cfz $(PYTHON_TARBALL) $(PYTHON_TARBALL_PREFIX)
|
||||||
rm -fr dist/$(PYTHON_TARBALL_PREFIX)
|
rm -fr dist/$(PYTHON_TARBALL_PREFIX)
|
||||||
|
|
||||||
# cleanup
|
|
||||||
rm -fr dist/freeipa
|
|
||||||
|
|
||||||
rpm-ipa-server:
|
rpm-ipa-server:
|
||||||
cp dist/$(SERV_TARBALL) ~/rpmbuild/SOURCES/.
|
cp dist/$(SERV_TARBALL) ~/rpmbuild/SOURCES/.
|
||||||
rpmbuild -ba ipa-server/freeipa-server.spec
|
rpmbuild -ba ipa-server/freeipa-server.spec
|
||||||
@@ -98,7 +105,9 @@ rpm-ipa-python:
|
|||||||
|
|
||||||
rpms: rpm-ipa-server rpm-ipa-admin rpm-ipa-python
|
rpms: rpm-ipa-server rpm-ipa-admin rpm-ipa-python
|
||||||
|
|
||||||
dist: version-update tarballs rpms
|
dist: version-update archive tarballs archive-cleanup rpms
|
||||||
|
|
||||||
|
local-dist: clean version-update local-archive tarballs archive-cleanup rpms
|
||||||
|
|
||||||
dist-clean: clean
|
dist-clean: clean
|
||||||
rm -fr dist
|
rm -fr dist
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import sys
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import ipa
|
import ipa
|
||||||
import ipa.rpcclient
|
import ipa.rpcclient
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
@@ -43,7 +45,8 @@ def parse_options():
|
|||||||
parser.add_option("--usage", action="store_true",
|
parser.add_option("--usage", action="store_true",
|
||||||
help="Program usage")
|
help="Program usage")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
args = ipa.config.init_config(sys.argv)
|
||||||
|
options, args = parser.parse_args(args)
|
||||||
|
|
||||||
if not options.gn or not options.sn:
|
if not options.gn or not options.sn:
|
||||||
usage()
|
usage()
|
||||||
@@ -52,14 +55,14 @@ def parse_options():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
user={}
|
user={}
|
||||||
(options, args) = parse_options()
|
options, args = parse_options()
|
||||||
|
|
||||||
if len(args) != 1:
|
if len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
user['gn'] = options.gn
|
user['gn'] = options.gn
|
||||||
user['sn'] = options.sn
|
user['sn'] = options.sn
|
||||||
user['uid'] = args[0]
|
user['uid'] = args[1]
|
||||||
if options.gecos:
|
if options.gecos:
|
||||||
user['gecos'] = options.gecos
|
user['gecos'] = options.gecos
|
||||||
if options.directory:
|
if options.directory:
|
||||||
|
|||||||
@@ -18,9 +18,12 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import ipa
|
import ipa
|
||||||
import ipa.rpcclient
|
import ipa.rpcclient
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import sys
|
import sys
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
@@ -32,19 +35,20 @@ def usage():
|
|||||||
def parse_options():
|
def parse_options():
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
args = ipa.config.init_config(sys.argv)
|
||||||
|
options, args = parser.parse_args(args)
|
||||||
|
|
||||||
return options, args
|
return options, args
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
user={}
|
user={}
|
||||||
(options, args) = parse_options()
|
options, args = parse_options()
|
||||||
|
|
||||||
if len(args) != 1:
|
if len(args) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ent = ipa.rpcclient.get_user(args[0])
|
ent = ipa.rpcclient.get_user(args[1])
|
||||||
for name, value in ent.items():
|
for name, value in ent.items():
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
print name + ": " + value
|
print name + ": " + value
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib(1)")
|
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib(1)")
|
||||||
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa
|
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa
|
||||||
|
CONFIGDIR ?= $(DESTDIR)/etc/ipa
|
||||||
|
|
||||||
all: ;
|
all: ;
|
||||||
|
|
||||||
install:
|
install:
|
||||||
-mkdir -p $(PACKAGEDIR)
|
-mkdir -p $(PACKAGEDIR)
|
||||||
install -m 644 *.py $(PACKAGEDIR)
|
install -m 644 *.py $(PACKAGEDIR)
|
||||||
|
-mkdir -p $(CONFIGDIR)
|
||||||
|
install -m 644 ipa.conf $(CONFIGDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.pyc
|
rm -f *~ *.pyc
|
||||||
@@ -15,6 +15,7 @@ Requires: python
|
|||||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
|
|
||||||
%define pkgpythondir %{python_sitelib}/ipa
|
%define pkgpythondir %{python_sitelib}/ipa
|
||||||
|
%define configdir /etc/ipa
|
||||||
|
|
||||||
%description
|
%description
|
||||||
FreeIPA is a server for identity, policy, and audit.
|
FreeIPA is a server for identity, policy, and audit.
|
||||||
@@ -25,6 +26,7 @@ FreeIPA is a server for identity, policy, and audit.
|
|||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
mkdir -p %{buildroot}%{pkgpythondir}
|
mkdir -p %{buildroot}%{pkgpythondir}
|
||||||
|
mkdir -p %{buildroot}%{configdir}
|
||||||
|
|
||||||
make install DESTDIR=%{buildroot}
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
@@ -36,6 +38,7 @@ rm -rf %{buildroot}
|
|||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{pkgpythondir}/*
|
%{pkgpythondir}/*
|
||||||
|
%config(noreplace) %{configdir}/ipa.conf
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Requires: python
|
|||||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
|
|
||||||
%define pkgpythondir %{python_sitelib}/ipa
|
%define pkgpythondir %{python_sitelib}/ipa
|
||||||
|
%define configdir /etc/ipa
|
||||||
|
|
||||||
%description
|
%description
|
||||||
FreeIPA is a server for identity, policy, and audit.
|
FreeIPA is a server for identity, policy, and audit.
|
||||||
@@ -25,6 +26,7 @@ FreeIPA is a server for identity, policy, and audit.
|
|||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
mkdir -p %{buildroot}%{pkgpythondir}
|
mkdir -p %{buildroot}%{pkgpythondir}
|
||||||
|
mkdir -p %{buildroot}%{configdir}
|
||||||
|
|
||||||
make install DESTDIR=%{buildroot}
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
@@ -36,6 +38,7 @@ rm -rf %{buildroot}
|
|||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{pkgpythondir}/*
|
%{pkgpythondir}/*
|
||||||
|
%config(noreplace) %{configdir}/ipa.conf
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
@@ -26,18 +26,25 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
import socket
|
import socket
|
||||||
import os
|
import config
|
||||||
import base64
|
|
||||||
|
|
||||||
# Some errors to catch
|
# Some errors to catch
|
||||||
# http://cvs.fedora.redhat.com/viewcvs/ldapserver/ldap/servers/plugins/pam_passthru/README?root=dirsec&rev=1.6&view=auto
|
# http://cvs.fedora.redhat.com/viewcvs/ldapserver/ldap/servers/plugins/pam_passthru/README?root=dirsec&rev=1.6&view=auto
|
||||||
|
|
||||||
|
def server_url():
|
||||||
|
return "http://" + config.config.get_server() + "/ipa"
|
||||||
|
|
||||||
# FIXME: do we want this set somewhere else?
|
# FIXME: do we want this set somewhere else?
|
||||||
server = xmlrpclib.ServerProxy("http://localhost:80/ipa")
|
server = None
|
||||||
|
|
||||||
|
def setup_server():
|
||||||
|
global server
|
||||||
|
if not server:
|
||||||
|
server = xmlrpclib.ServerProxy(server_url())
|
||||||
|
|
||||||
def get_user(username):
|
def get_user(username):
|
||||||
"""Get a specific user"""
|
"""Get a specific user"""
|
||||||
|
setup_server()
|
||||||
try:
|
try:
|
||||||
result = server.get_user(username)
|
result = server.get_user(username)
|
||||||
myuser = result
|
myuser = result
|
||||||
@@ -52,9 +59,10 @@ def get_user(username):
|
|||||||
|
|
||||||
def add_user(user):
|
def add_user(user):
|
||||||
"""Add a new user"""
|
"""Add a new user"""
|
||||||
|
setup_server()
|
||||||
|
|
||||||
# FIXME: Get the realm from somewhere
|
# FIXME: Get the realm from somewhere
|
||||||
realm="GREYOAK.COM"
|
realm = config.config.get_realm()
|
||||||
|
|
||||||
# FIXME: This should be dynamic and can include just about anything
|
# FIXME: This should be dynamic and can include just about anything
|
||||||
# Let us add in some missing attributes
|
# Let us add in some missing attributes
|
||||||
@@ -87,13 +95,14 @@ def get_add_schema():
|
|||||||
"""Get the list of attributes we need to ask when adding a new
|
"""Get the list of attributes we need to ask when adding a new
|
||||||
user.
|
user.
|
||||||
"""
|
"""
|
||||||
|
setup_server()
|
||||||
|
|
||||||
# FIXME: Hardcoded and designed for the TurboGears GUI. Do we want
|
# FIXME: Hardcoded and designed for the TurboGears GUI. Do we want
|
||||||
# this for the CLI as well?
|
# this for the CLI as well?
|
||||||
try:
|
try:
|
||||||
result = server.get_add_schema()
|
result = server.get_add_schema()
|
||||||
except xmlrpclib.Fault, fault:
|
except xmlrpclib.Fault, fault:
|
||||||
raise xmlrpclib.Fault(fault,faultCode, fault.faultString)
|
raise xmlrpclib.Fault(fault, fault.faultString)
|
||||||
return None
|
return None
|
||||||
except socket.error, (value, msg):
|
except socket.error, (value, msg):
|
||||||
raise xmlrpclib.Fault(value, msg)
|
raise xmlrpclib.Fault(value, msg)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ def logging_setup(options):
|
|||||||
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
|
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
|
||||||
console.setFormatter(formatter)
|
console.setFormatter(formatter)
|
||||||
logging.getLogger('').addHandler(console)
|
logging.getLogger('').addHandler(console)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
options = parse_options()
|
options = parse_options()
|
||||||
logging_setup(options)
|
logging_setup(options)
|
||||||
@@ -119,6 +119,13 @@ def main():
|
|||||||
# Restart apache
|
# Restart apache
|
||||||
run(["/sbin/service", "httpd", "restart"])
|
run(["/sbin/service", "httpd", "restart"])
|
||||||
|
|
||||||
|
# Create the config file
|
||||||
|
fd = open("/etc/ipa/ipa.conf", "w")
|
||||||
|
fd.write("[defaults]\n")
|
||||||
|
fd.write("server=" + host_name + "\n")
|
||||||
|
fd.write("realm=" + options.realm_name + "\n")
|
||||||
|
fd.close()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ sys.path.append("/usr/share/ipa")
|
|||||||
import ldap
|
import ldap
|
||||||
import ipaserver.dsinstance
|
import ipaserver.dsinstance
|
||||||
import ipaserver.ipaldap
|
import ipaserver.ipaldap
|
||||||
|
import ipaserver.util
|
||||||
import pdb
|
import pdb
|
||||||
import string
|
import string
|
||||||
from types import *
|
from types import *
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
import ipa.config
|
||||||
|
|
||||||
# FIXME, this needs to be auto-discovered
|
# FIXME, this needs to be auto-discovered
|
||||||
host = 'localhost'
|
host = 'localhost'
|
||||||
@@ -34,7 +36,10 @@ port = 389
|
|||||||
binddn = "cn=directory manager"
|
binddn = "cn=directory manager"
|
||||||
bindpw = "freeipa"
|
bindpw = "freeipa"
|
||||||
|
|
||||||
basedn = "dc=greyoak,dc=com"
|
ipa.config.init_config()
|
||||||
|
basedn = ipaserver.util.realm_to_suffix(ipa.config.config.get_realm())
|
||||||
|
import sys
|
||||||
|
sys.stderr.write(basedn)
|
||||||
scope = ldap.SCOPE_SUBTREE
|
scope = ldap.SCOPE_SUBTREE
|
||||||
|
|
||||||
def get_user (username):
|
def get_user (username):
|
||||||
@@ -85,7 +90,7 @@ def get_user (username):
|
|||||||
|
|
||||||
def add_user (user):
|
def add_user (user):
|
||||||
"""Add a user in LDAP"""
|
"""Add a user in LDAP"""
|
||||||
dn="uid=%s,ou=users,ou=default,dc=greyoak,dc=com" % user['uid']
|
dn="uid=%s,ou=users,ou=default,%s" % (user['uid'], basedn)
|
||||||
entry = ipaserver.ipaldap.Entry(dn)
|
entry = ipaserver.ipaldap.Entry(dn)
|
||||||
|
|
||||||
# some required objectclasses
|
# some required objectclasses
|
||||||
|
|||||||
Reference in New Issue
Block a user