summaryrefslogtreecommitdiffstats
path: root/scripts/cobbler_auth_help
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-12-05 18:59:24 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-12-05 18:59:24 -0500
commit0805e18d1e4077605b382acb9322996a90782c4d (patch)
tree098ba9d7b7655a910d69e6ea692b7a05fad79139 /scripts/cobbler_auth_help
parent6bd19ac076e5d4c51317d85fd5d12965e65cae66 (diff)
downloadthird_party-cobbler-0805e18d1e4077605b382acb9322996a90782c4d.tar.gz
third_party-cobbler-0805e18d1e4077605b382acb9322996a90782c4d.tar.xz
third_party-cobbler-0805e18d1e4077605b382acb9322996a90782c4d.zip
Some initial work on kerberos authentication via a helper program, some work on making the API have access to the log files and logging everything done there. The logging work, as well as kerb testing, are incomplete at this point, though
authn_configfile works fine.
Diffstat (limited to 'scripts/cobbler_auth_help')
-rw-r--r--scripts/cobbler_auth_help54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/cobbler_auth_help b/scripts/cobbler_auth_help
new file mode 100644
index 0000000..12a38b0
--- /dev/null
+++ b/scripts/cobbler_auth_help
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+# Kerberos helper for logins
+#
+# Copyright 2007, Red Hat, Inc
+# Michael DeHaan <mdehaan@redhat.com>
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Usage:
+# cobbler_auth_helper kerberos username pass
+# (may do other auth types later)
+# Returns:
+# 0 on ok, non-0 on failure
+# API info:
+# http://search.cpan.org/~chansen/Authen-Simple-Kerberos-0.1/
+
+use warnings;
+use strict;
+use Authen::Simple::Kerberos;
+use Getopt::Long;
+
+my $method;
+my $username;
+my $realm;
+my $password;
+my $verbose=0;
+
+my $result = GetOptions(
+ "method=s" => \$method,
+ "username=s" => \$username,
+ "realm=s" => \$realm,
+ "password=s" => \$password,
+);
+
+my $kerberos = Authen::Simple::Kerberos->new(
+ realm => $realm
+);
+
+print "authenticating: $username against $method $realm ($password)\n" if $verbose;
+
+if ( $kerberos->authenticate( $username, $password ) ) {
+ print "ok\n" if $verbose;
+ exit(42);
+}
+
+print "denied\n" if $verbose;
+exit(1);
+