Changeset c0a8738 for fedkit


Ignore:
Timestamp:
Feb 14, 2010 2:25:46 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
b7f6ccc
Parents:
d87778f
Message:

Moving toward the federation scripts that don't rely on tmcd forwarding.

Location:
fedkit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fedkit/Makefile

    rd87778f rc0a8738  
    1 BINARIES=federate.sh smbmount.FreeBSD.pl smbmount.Linux.pl \
     1BINARIES=federate.sh federate.pl smbmount.FreeBSD.pl smbmount.Linux.pl \
    22         make_hosts fed-tun.pl fed_evrepeater rc.fedaccounts \
    33         config_from_tunnelip.pl active_config.pl combo.pl \
  • fedkit/rc.fedaccounts

    rd87778f rc0a8738  
    3939
    4040my $old_accts = "/usr/local/federation/etc/old_accts";
    41 my $accts = "/usr/local/federation/etc/accts";
     41my $accts = "/usr/local/federation/etc/userconf";
    4242
    4343fatal("Need both $old_accts and $accts") unless -e $old_accts && -e $accts;
     
    8181        os_groupadd($group, $gid);
    8282    };
    83     /^ADDUSER\s+LOGIN=([-\w]+)\s+PSWD=([^:]+)\s+UID=(\d+)\s+GID=(\d+)\s+
    84         ROOT=(\d)\s+NAME="([^"]+)"\s+HOMEDIR=(\S+)\s+GLIST="([^"]*)"\s+
    85         SERIAL=(\d+)\s+EMAIL="([^"]*)"\s+SHELL=(\S+)/x && do {
    86             my ($login, $pswd, $uid, $gid, $root, $name, $hdir, $glist,
    87                 $serial, $email, $shell) =
    88             ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);
     83    /^ADDUSER\s+/ && do {
     84        my $login;
     85        my $pswd;
     86        my $uid;
     87        my $gid;
     88        my $root;
     89        my $name;
     90        my $hdir;
     91        my $glist;
     92        my $serial;
     93        my $email;
     94        my $shell;
    8995
    90             print "Adding $login $uid $gid\n";
    91             os_useradd($login, $uid, $gid, $pswd, "$glist", $hdir, $name,
    92                 $root, $shell);
    93             os_mkdir($hdir, "0755") unless -e $hdir;
    94             next;
     96        /LOGIN=([\S]+)/ && do { $login = $1; };
     97        /PSWD=(\S+)/ && do { $pswd=$1; } ;
     98        /UID=(\d+)/ && do { $uid = $1; };
     99        /GID=(\d+)/ && do { $gid = $1; };
     100        /ROOT=(\d)/ && do { $root = $1; };
     101        /NAME="([^"]*)"/ && do { $name = $1; };
     102        /HOMEDIR=(\S+)/ && do { $hdir = $1; };
     103        /GLIST="([^"]*)"/ && do { $glist = $1; };
     104        /SERIAL=(\d+)/ && do { $serial = $1; };
     105        /EMAIL="([^"]*)"/ && do { $email=$1; };
     106        /SHELL=(\S+)/ && do { $shell = $1; };
     107
     108        print "Adding $login $uid $gid\n";
     109        os_useradd($login, $uid, $gid, $pswd, "$glist", $hdir, $name,
     110            $root, $shell);
     111        os_mkdir($hdir, "0755") unless -e $hdir;
     112        next;
    95113    };
    96114}
  • fedkit/smbmount.FreeBSD.pl

    rd87778f rc0a8738  
    4040}
    4141
    42 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     42# open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     43open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf");
    4344open(CONFIG, ">/etc/nsmb.conf") or die("Failed to open /etc/nsmb.conf");
    4445open(MAP, ">$AMDMAP") or die("Failed to open $AMDMAP");
     
    5253
    5354while(<TM>) {
    54         if (/ADDUSER LOGIN=(\S+) PSWD=(\S+) UID=(\d+) GID=(\d+).*HOMEDIR=(\S+) / ) {
    55                 $user = $1;
    56                 $pswd = $2;
    57                 $uid  = $3;
    58                 $gid  = $4;
    59                 $homedir = $5;
     55    /ADDUSER/ && do {
     56        /LOGIN=(\S+)/ && do { $user = $1; };
     57        /WPSWD=(\S+)/ && do { $pswd = $1; };
     58        /UID=(\S+)/ && do { $uid = $1; };
     59        /GID=(\S+)/ && do { $gid = $1; };
     60        /HOMEDIR=(\S+)/ && do { $homedir = $1; };
    6061
    61                 $userlc = $user;
    62                 # SMB demands upper case.
    63                 $user =~  tr/a-z/A-Z/;
    64                 my $pass = `smbutil crypt '$pswd'`;
     62        $userlc = $user;
     63        # SMB demands upper case.
     64        $user =~  tr/a-z/A-Z/;
     65        my $pass = `smbutil crypt '$pswd'`;
    6566
    66                 print CONFIG "[$SHARE:$user]\npassword=$pass\n";
    67                
    68                 if(! -d "$AMDROOT$homedir") {
    69                         system("$MKDIR -p $AMDROOT$homedir") && die("Failed to make directory");
    70                 }
     67        print CONFIG "[$SHARE:$user]\npassword=$pass\n";
     68       
     69        if(! -d "$AMDROOT$homedir") {
     70                system("$MKDIR -p $AMDROOT$homedir") &&
     71                    die("Failed to make directory");
     72        }
    7173
    72                 print FSTAB "//$user\@$SHARE/$user\t";
    73                 print FSTAB "$AMDROOT$homedir\tsmbfs\t";
    74                 print FSTAB "noauto,rw,-N,-f744,-d755,-u$uid,-g$gid\t0\t0\n";
     74        print FSTAB "//$user\@$SHARE/$user\t";
     75        print FSTAB "$AMDROOT$homedir\tsmbfs\t";
     76        print FSTAB "noauto,rw,-N,-f744,-d755,-u$uid,-g$gid\t0\t0\n";
    7577
    76                 print MAP "\n$userlc type:=program;fs:=$AMDROOT$homedir;\\\n";
    77                 print MAP "mount:=\"$MOUNT mount $AMDROOT$homedir\";\\\n";
    78                 print MAP "unmount:=\"$UMOUNT unmount $AMDROOT$homedir\";";
     78        print MAP "\n$userlc type:=program;fs:=$AMDROOT$homedir;\\\n";
     79        print MAP "mount:=\"$MOUNT mount $AMDROOT$homedir\";\\\n";
     80        print MAP "unmount:=\"$UMOUNT unmount $AMDROOT$homedir\";";
    7981
    80                 #
    81                 # If we are PUSER, the user assigned to mount the project directory,
    82                 # then we add in the mount for that.  The share is called proj-$PNAME
    83                 # where PNAME is the name of the project at the mothership.  We need
    84                 # a second map for this since we will be mounting under /proj.
    85                 # We should really not use share in federation.
    86                 #
     82        #
     83        # If we are PUSER, the user assigned to mount the project directory,
     84        # then we add in the mount for that.  The share is called proj-$PNAME
     85        # where PNAME is the name of the project at the mothership.  We need
     86        # a second map for this since we will be mounting under /proj.
     87        # We should really not use share in federation.
     88        #
    8789
    88                 if($user =~ m/$PUSER/i) {
    89                         print FSTAB "//$user\@$SHARE/proj-$PNAME\t";
    90                         print FSTAB "$AMDROOT/proj\tsmbfs\t";
    91                         print FSTAB "noauto,rw,-N,-f774,-d775,-u$uid,-g$gid\t0\t0\n";
     90        if($user =~ m/$PUSER/i) {
     91            print FSTAB "//$user\@$SHARE/proj-$PNAME\t";
     92            print FSTAB "$AMDROOT/proj\tsmbfs\t";
     93            print FSTAB "noauto,rw,-N,-f774,-d775,-u$uid,-g$gid\t0\t0\n";
    9294
    93                         print PMAP "$PNAME type:=program;fs:=$AMDROOT/proj;\\\n";
    94                         print PMAP "mount:=\"$MOUNT mount $AMDROOT/proj\";\\\n";
    95                         print PMAP "unmount:=\"$UMOUNT unmount $AMDROOT/proj\";\n";
     95            print PMAP "$PNAME type:=program;fs:=$AMDROOT/proj;\\\n";
     96            print PMAP "mount:=\"$MOUNT mount $AMDROOT/proj\";\\\n";
     97            print PMAP "unmount:=\"$UMOUNT unmount $AMDROOT/proj\";\n";
    9698
    97                         if(! -d "$AMDROOT/proj") {
    98                                 system("$MKDIR -p $AMDROOT/proj") && die("Failed to make directory");
    99                         }
    100                 }
    101         }
     99            if(! -d "$AMDROOT/proj") {
     100                    system("$MKDIR -p $AMDROOT/proj") &&
     101                        die("Failed to make directory");
     102            }
     103        }
     104    }
    102105}
    103106
  • fedkit/smbmount.Linux.pl

    rd87778f rc0a8738  
    4343}
    4444
    45 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     45# open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     46open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf");
    4647open(FSTAB,">>$FSTAB") or die("Cannot Open File $FSTAB");
    4748
     
    4950
    5051while(<TM>) {
    51         if (/ADDUSER LOGIN=(\S+) PSWD=(\S+) UID=(\d+) GID=(\d+).*HOMEDIR=(\S+) / ) {
    52                 ($user, $pswd, $uid, $gid, $homedir) = ($1, $2, $3, $4, $5);
     52    /ADDUSER/ && do {
     53        /LOGIN=(\S+)/ && do { $user = $1; };
     54        /WPSWD=(\S+)/ && do { $pswd = $1; };
     55        /UID=(\S+)/ && do { $uid = $1; };
     56        /GID=(\S+)/ && do { $gid = $1; };
     57        /HOMEDIR=(\S+)/ && do { $homedir = $1; };
    5358
     59        open(PWDFILE, ">/tmp/$user.cifs_creds") ||
     60            warn "Can't create credentials for $user:$!\n";
     61        print PWDFILE "username=$user\npassword=$pswd\n";
     62        close(PWDFILE);
     63        chmod(0600, "/tmp/$user.cifs_creds") == 1 ||
     64            warn "Credential file /tmp/$user.cifs_creds may have " .
     65                "bad permissions:$!\n";
    5466
    55                 open(PWDFILE, ">/tmp/$user.cifs_creds") ||
    56                     warn "Can't create credentials for $user:$!\n";
    57                 print PWDFILE "username=$user\npassword=$pswd\n";
    58                 close(PWDFILE);
    59                 chmod(0600, "/tmp/$user.cifs_creds") == 1 ||
    60                     warn "Credential file /tmp/$user.cifs_creds may have " .
    61                         "bad permissions:$!\n";
     67        print FSTAB "//$SHARE/$user\t";
     68        print FSTAB "$homedir\tcifs\t";
     69        print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    6270
    63                 print FSTAB "//$SHARE/$user\t";
    64                 print FSTAB "$homedir\tcifs\t";
    65                 print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
     71        #
     72        # If we are PUSER, the user assigned to mount the project
     73        # directory, then we add in the mount for that.  The share is
     74        # called proj-$PNAME where PNAME is the name of the project at
     75        # the mothership.  We need a second map for this since we will
     76        # be mounting under /proj.  We should really not use share in
     77        # federation.
     78        #
    6679
    67                 #
    68                 # If we are PUSER, the user assigned to mount the project
    69                 # directory, then we add in the mount for that.  The share is
    70                 # called proj-$PNAME where PNAME is the name of the project at
    71                 # the mothership.  We need a second map for this since we will
    72                 # be mounting under /proj.  We should really not use share in
    73                 # federation.
    74                 #
     80        if($user =~ m/$PUSER/i) {
     81            print FSTAB "//$SHARE/proj-$PNAME\t";
     82            print FSTAB "$PROJROOT/$PNAME\tcifs\t";
     83            print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    7584
    76                 if($user =~ m/$PUSER/i) {
    77                         print FSTAB "//$SHARE/proj-$PNAME\t";
    78                         print FSTAB "$PROJROOT/$PNAME\tcifs\t";
    79                         print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    80 
    81                 }
    82         }
     85        }
     86    }
    8387}
    8488
Note: See TracChangeset for help on using the changeset viewer.