Changeset c0a8738
- Timestamp:
- Feb 14, 2010 2:25:46 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- b7f6ccc
- Parents:
- d87778f
- Location:
- fedkit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/Makefile
rd87778f rc0a8738 1 BINARIES=federate.sh smbmount.FreeBSD.pl smbmount.Linux.pl \1 BINARIES=federate.sh federate.pl smbmount.FreeBSD.pl smbmount.Linux.pl \ 2 2 make_hosts fed-tun.pl fed_evrepeater rc.fedaccounts \ 3 3 config_from_tunnelip.pl active_config.pl combo.pl \ -
fedkit/rc.fedaccounts
rd87778f rc0a8738 39 39 40 40 my $old_accts = "/usr/local/federation/etc/old_accts"; 41 my $accts = "/usr/local/federation/etc/ accts";41 my $accts = "/usr/local/federation/etc/userconf"; 42 42 43 43 fatal("Need both $old_accts and $accts") unless -e $old_accts && -e $accts; … … 81 81 os_groupadd($group, $gid); 82 82 }; 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; 89 95 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; 95 113 }; 96 114 } -
fedkit/smbmount.FreeBSD.pl
rd87778f rc0a8738 40 40 } 41 41 42 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC"); 42 # open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC"); 43 open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf"); 43 44 open(CONFIG, ">/etc/nsmb.conf") or die("Failed to open /etc/nsmb.conf"); 44 45 open(MAP, ">$AMDMAP") or die("Failed to open $AMDMAP"); … … 52 53 53 54 while(<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; }; 60 61 61 62 63 64 62 $userlc = $user; 63 # SMB demands upper case. 64 $user =~ tr/a-z/A-Z/; 65 my $pass = `smbutil crypt '$pswd'`; 65 66 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 } 71 73 72 73 74 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"; 75 77 76 77 78 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\";"; 79 81 80 81 82 83 84 85 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 # 87 89 88 89 90 91 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"; 92 94 93 94 95 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"; 96 98 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 } 102 105 } 103 106 -
fedkit/smbmount.Linux.pl
rd87778f rc0a8738 43 43 } 44 44 45 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC"); 45 # open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC"); 46 open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf"); 46 47 open(FSTAB,">>$FSTAB") or die("Cannot Open File $FSTAB"); 47 48 … … 49 50 50 51 while(<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; }; 53 58 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"; 54 66 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"; 62 70 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 # 66 79 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"; 75 84 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 } 83 87 } 84 88
Note: See TracChangeset
for help on using the changeset viewer.