[OpenAFS] Any way to create srvtabs for use with kaserver...

Charles Clancy security@xauth.net
Sat, 2 Mar 2002 22:51:29 -0600 (CST)


Alright, with all the conversation concerning different ways to do this,
here's a complete solution.  The perl script below takes the appropriate
parameters, formats, and appends them into a K4 srvtab file.

Assuming you have /etc/krb.conf and /etc/krb.realms properly configured,
simply run:
    /usr/local/athena/bin/kauth -n username -f /path/to/srvtab

If you want a PAG, then do a pagsh first.  Simple as that.

------ makesrvtab.pl ------

#!/usr/local/bin/perl
#
# Author: Charles Clancy, tclancy@uiuc.edu
# makesrvtab.pl, version 0.badhack
#

$name           = "tclancy";	     # standard AFS username
$instance       = "";                # usually left blank
$cell           = "xauth.net";       # cell name
$kvno           = 2;                 # kvno / do a 'kas examine'
$password       = "secretpass";      # users's AFS password
$srvtab         = "/etc/srvtab";     # srvtab file

$cell =~ tr/a-z/A-Z/;
chomp($key=`kas stringtokey '$password' | head -1 | cut -f 2 -d '='`);
$key =~ s/\.//; $key =~ s/\'//g;

@l=split(/\\/,$key);
for $a (1..$#l) { $l[$a] = oct($l[$a]); } shift(@l);
$s = pack("CCCCCCCC",@l);

open (st,">>$srvtab");
   print st $name."\0".$instance."\0".$cell."\0";
   printf st "%c",$kvno;
   print st $s;
close(st);