summaryrefslogtreecommitdiffstats
path: root/ipa-admintools
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-admintools')
-rw-r--r--ipa-admintools/Makefile10
-rw-r--r--ipa-admintools/README0
-rwxr-xr-xipa-admintools/freeipa-admintools.spec42
-rwxr-xr-xipa-admintools/freeipa-admintools.spec.in42
-rw-r--r--ipa-admintools/ipa-adduser80
-rw-r--r--ipa-admintools/ipa-finduser60
6 files changed, 234 insertions, 0 deletions
diff --git a/ipa-admintools/Makefile b/ipa-admintools/Makefile
new file mode 100644
index 00000000..e0fd405a
--- /dev/null
+++ b/ipa-admintools/Makefile
@@ -0,0 +1,10 @@
+SBINDIR = $(DESTDIR)/usr/sbin
+
+all: ;
+
+install:
+ install -m 755 ipa-adduser $(SBINDIR)
+ install -m 755 ipa-finduser $(SBINDIR)
+
+clean:
+ rm -f *~ *.pyc
diff --git a/ipa-admintools/README b/ipa-admintools/README
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ipa-admintools/README
diff --git a/ipa-admintools/freeipa-admintools.spec b/ipa-admintools/freeipa-admintools.spec
new file mode 100755
index 00000000..bcd3d9d2
--- /dev/null
+++ b/ipa-admintools/freeipa-admintools.spec
@@ -0,0 +1,42 @@
+Name: freeipa-admintools
+Version: 0.1.0
+Release: 1%{?dist}
+Summary: FreeIPA authentication server
+
+Group: System Environment/Base
+License: GPL
+URL: http://www.freeipa.org
+Source0: %{name}-%{version}.tgz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+Requires: python freeipa-python
+
+%description
+FreeIPA is a server for identity, policy, and audit.
+
+%prep
+%setup -q
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_sbindir}
+
+make install DESTDIR=%{buildroot}
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{_sbindir}/ipa-adduser
+%{_sbindir}/ipa-finduser
+
+
+%changelog
+* Fri Jul 27 2007 Karl MacMillan <kmacmill@localhost.localdomain> - 0.1.0-1
+- Initial rpm version
+
+
diff --git a/ipa-admintools/freeipa-admintools.spec.in b/ipa-admintools/freeipa-admintools.spec.in
new file mode 100755
index 00000000..bcd3d9d2
--- /dev/null
+++ b/ipa-admintools/freeipa-admintools.spec.in
@@ -0,0 +1,42 @@
+Name: freeipa-admintools
+Version: 0.1.0
+Release: 1%{?dist}
+Summary: FreeIPA authentication server
+
+Group: System Environment/Base
+License: GPL
+URL: http://www.freeipa.org
+Source0: %{name}-%{version}.tgz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+Requires: python freeipa-python
+
+%description
+FreeIPA is a server for identity, policy, and audit.
+
+%prep
+%setup -q
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_sbindir}
+
+make install DESTDIR=%{buildroot}
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{_sbindir}/ipa-adduser
+%{_sbindir}/ipa-finduser
+
+
+%changelog
+* Fri Jul 27 2007 Karl MacMillan <kmacmill@localhost.localdomain> - 0.1.0-1
+- Initial rpm version
+
+
diff --git a/ipa-admintools/ipa-adduser b/ipa-admintools/ipa-adduser
new file mode 100644
index 00000000..b40fdee2
--- /dev/null
+++ b/ipa-admintools/ipa-adduser
@@ -0,0 +1,80 @@
+#! /usr/bin/python -E
+# Authors: Rob Crittenden <rcritten@redhat.com>
+#
+# 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
+#
+
+import sys
+from optparse import OptionParser
+import ipa
+import ipa.rpcclient
+import xmlrpclib
+
+def usage():
+ print "ipa-adduser [-c|--gecos STRING] [-d|--directory STRING] [-f|--firstname STRING] [-l|--lastname STRING] user"
+ sys.exit(1)
+
+def parse_options():
+ parser = OptionParser()
+ parser.add_option("-c", "--gecos", dest="gecos",
+ help="Set the GECOS field")
+ parser.add_option("-d", "--directory", dest="directory",
+ help="Set the User's home directory")
+ parser.add_option("-f", "--firstname", dest="gn",
+ help="User's first name")
+ parser.add_option("-l", "--lastname", dest="sn",
+ help="User's last name")
+ parser.add_option("-s", "--shell", dest="shell",
+ help="Set user's login shell to shell")
+ parser.add_option("--usage", action="store_true",
+ help="Program usage")
+
+ (options, args) = parser.parse_args()
+
+ if not options.gn or not options.sn:
+ usage()
+
+ return options, args
+
+def main():
+ user={}
+ (options, args) = parse_options()
+
+ if len(args) != 1:
+ usage()
+
+ user['gn'] = options.gn
+ user['sn'] = options.sn
+ user['uid'] = args[0]
+ if options.gecos:
+ user['gecos'] = options.gecos
+ if options.directory:
+ user['homedirectory'] = options.directory
+ if options.shell:
+ user['loginshell'] = options.shell
+ else:
+ user['loginshell'] = "/bin/bash"
+
+ try:
+ ipa.rpcclient.add_user(user)
+ print args[0] + " successfully added"
+ except xmlrpclib.Fault, f:
+ print f.faultString
+
+ return 0
+
+main()
diff --git a/ipa-admintools/ipa-finduser b/ipa-admintools/ipa-finduser
new file mode 100644
index 00000000..205b47ce
--- /dev/null
+++ b/ipa-admintools/ipa-finduser
@@ -0,0 +1,60 @@
+#! /usr/bin/python -E
+# Authors: Rob Crittenden <rcritten@redhat.com>
+#
+# 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
+#
+
+from optparse import OptionParser
+import ipa
+import ipa.rpcclient
+import base64
+import sys
+import xmlrpclib
+
+def usage():
+ print "ipa-finduser <uid>"
+ sys.exit()
+
+def parse_options():
+ parser = OptionParser()
+
+ (options, args) = parser.parse_args()
+
+ return options, args
+
+def main():
+ user={}
+ (options, args) = parse_options()
+
+ if len(args) != 1:
+ usage()
+
+ try:
+ ent = ipa.rpcclient.get_user(args[0])
+ for name, value in ent.items():
+ if isinstance(value, str):
+ print name + ": " + value
+ else:
+ print name + ": "
+ for x in value:
+ print "\t" + x
+ except xmlrpclib.Fault, fault:
+ print fault.faultString
+
+ return 0
+
+main()