diff options
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/create-kdc-principal.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/scripts/create-kdc-principal.pl b/src/scripts/create-kdc-principal.pl new file mode 100755 index 0000000..ec541da --- /dev/null +++ b/src/scripts/create-kdc-principal.pl @@ -0,0 +1,18 @@ +#!/usr/bin/env perl + +use Heimdal::Kadm5 qw(/KADM5_/); + +$client = Heimdal::Kadm5::Client->new('RaiseErrors'=>1,'Principal'=>'shibboleth-idp@NORDU.NET',Keytab=>'/etc/useradmin.keytab'); +my $line = <STDIN>; +my ($user,$pass) = split('\s+',$line); +die "Missing parameters on stdin\n" unless ($user and $pass); +my ($local,$domain) = split('\@',$user); + +my $pn = "$local\@NORDU.NET"; +my $p = $client->getPrincipal($pn); +unless ($p) { + $p = $client->makePrincipal($pn); + $client->createPrincipal($p,$pass); +} else { + $client->changePassword($pn,$pass); +} |