From 79d1e244e690d985d8a7a9d9771200dd23bffae1 Mon Sep 17 00:00:00 2001 From: Mike Hibler Date: Fri, 12 Oct 2007 21:34:01 +0000 Subject: [PATCH] Russ C.'s old Windows stuff --- tmcd/win32/README.txt | 219 -------------------- tmcd/win32/liblocsetup.pm | 412 -------------------------------------- 2 files changed, 631 deletions(-) delete mode 100755 tmcd/win32/README.txt delete mode 100755 tmcd/win32/liblocsetup.pm diff --git a/tmcd/win32/README.txt b/tmcd/win32/README.txt deleted file mode 100755 index ac0f7a305..000000000 --- a/tmcd/win32/README.txt +++ /dev/null @@ -1,219 +0,0 @@ -Timeline: - -Absolute Essential and #1 Priority Tasks: -* Setup accounts - -Current Status: We can currently create local users according - to information received from tmcc. The main outstanding - issues is that our system is not intragrated into the normal - perl/emulab way of doing things and the password is the - default password. - Current Task: - -I am working on getting the testbed boot code to create users - using the Microsoft addusers.exe program. Right now I am - going to have a dependency on cygwin, hopfully that can go - away in the future. - Questions: - -How do I figure out how the testbed code starts up? - -How do we store a password as a user accounts password that - has already went through the NThash algorithm? - Notes: - -FreeBSD supports storing the NThash password hash, the code to - do this is in src/lib/libcrypt/crypt-nthash.c - -Kirk will work on getting the password to sync between Unix - and Windows - -Ideas Windows Services for Unix 3.0 is something that could - be looked into. The problem that we have with this software - is the documentation is just really poor - -Okay users now autocreate when Windows first boots!!! The - following is the current command I use inside of cygwin to - make "it" happen. - - $ cygrunsrv -I startupService -p /cygdrive/c/Python22/python.exe -c /cygdrive/c - /thesis -a "c:\thesis\createUsers.py" - -I am now working to get this to happen from the Perl Script. - So right now becuase we are not mounting directories like we - need to I created a local directory /proj, this should be - removed later. - -The script to start with is testbed/tmcd/common/rc.setup - -I am using /etc/testbed as the location to "put things" - -The perl script will now setup accounts and get things up and running - -We really need to get some kind of script to install the - emulab infestructore onto a Windows Node, or at least I need - to come up with a more systimatic way of setting this up from - a clean install of Windows. - Tasks Complete: - -I helped port TMCC to Windows and saw that the code was checked in -* Get the computer to change it's SID and hostname on bootup (Completion Date: 26 June) - -The SID is basically a private key generated for a machine - when Windows is installed. We will probably use - (http://www.sysinternals.com/ntw2k/source/newsid.shtml) to - change the SID. - -For the time being the SID will be created randomly if - the file "i_have_changed_the_sid" does not exist - -A weblink for info on SIDs - http://www.win2000mag.com/Articles/Print.cfm?ArticleID=3469 - -Changing the hostname should be pretty straightforward, but I - have not yet tried to do this from a command line, and I am - unclear on exactly what the Windows "hostname" should be. - -I should also mention that without really ugly (and dangerous) - hacking setting this info this will require a - reboot. Personally I just don't think there is a safe way - around this issue at least with the current version of - Windows. Rebooting should add 1-2 min to the experiment - configure time. So if people have ideas then please let me - know. -* Get the home directories to mount (Completion Date: 30 June) - -Our plan here is to use Windows Services for Unix and just - have Windows mount the NFS shares. - -There are various other ways that this could be done. We - could setup SAMBA on users or setup an active directory - Windows Server and there is probably a couple of other things - that would work that I am not thinking of now. -* Interface support (5 July) - -Interface's need to be setup "correctly" -* Write Report (15 July) - ------------------------------------------------------------------------------ - -Things That Must Be Done, but After the "Absolute Essential tasks are done: -* idle daemon -* automatically software install (sysinstall or something else), maybe also do auto .tar.gz files -* startup commands - -Things That Would Be Nice To Have: -* event system -* ipod -* traffic generation -* program objects -* node virtualization/link virtualization -* console login -* program objects - -Things Kirk will look into: -* windows client support for elvin -* idle detection -* NFS -russ driving -* password syncing between Windows and Unix - -Other notes: -We want to use cygwin as much as possible so we can keep the same source code base. - -How are people going to want to use this? How much will they use specific features of Windows like "windows networking"? - -Security of windows is going to be a concern among our users. - -Are users going to want to use the Windows Clients to test performance? - -Are users going to want Windows generating automated web traffic? - - -TMCC Notes: - -[These are the TMCC commands that need to be used on windows, if the -TMCC command is not listed here it will not be supported. There is -also some notes about the command and what it will do in a windows -Environment, for the most part I will just use the already existing -Perl code to do this stuff. But I will not worry about merging my -changes back in someone else will take my work and make sure it is -correctly merged back into the system.] - -ifconfig - match MAC address of the card with the interface in Windows - -routing - add routes - -state - "I am up" - -nodeid - Returned result goes into a file. - -hostnames - -tarballs - -startupcmd - path of stuff to execute - -startstatus -whatever execs start command report w/start - -mounts - -reset - look to see if this is used anymore - -routing - do - -creator - This is something that should happen, but it might prove to -be quite difficult to change who you are in windows. Kirk will look -into this. - -state - report state - -isalive - do this - -Time Synronozation - -Windows has the option to sync with an ntp server and should be - configured to sync with users.emulab.net or boss. As a long term - goal it might be worth looking to supporting ntpinfo, and - ntpdrift. - - -------- -Notes to self: -/usr/testbed/bin/tip.old -9600 pc35_tty - -state - report state - -isalive - do this - -ntp info - long term -services - -ntp drift - long term unix file - -runas pg 649 - -sharutils - -changing SID - -TMCC - creates users -Mount home directories - User directories u: drive - project directories p: drive - -creates a service -set the host name -change SSIDE -setup accounts -get home directories to mount -merge TMCC - -services for Unix - -made up password -proper groups - -ifconfig - match MAC address with interface -routing - add routes -turn on/off ip forwarding -goal 1 reboot -state - I am up -account -nodeid - goes in file -hostnames[V2] - wahtever one the scripts do - -you want to use libsetup.pm - maybe this is an end goal and then merge - -libloc - -look @ rpms - -startupcmd - path of stuff to execute - -startstatus - whatever execs startup command reports w/startcmd - -mounts - -reset - look to see if this is used anymore - -routing -do - -creator - look into something that should happen - -$group $id $username @name - diff --git a/tmcd/win32/liblocsetup.pm b/tmcd/win32/liblocsetup.pm deleted file mode 100755 index 9195ff505..000000000 --- a/tmcd/win32/liblocsetup.pm +++ /dev/null @@ -1,412 +0,0 @@ -#!/usr/bin/perl -wT -# -# EMULAB-COPYRIGHT -# Copyright (c) 2000-2004 University of Utah and the Flux Group. -# All rights reserved. -# - -# -# Linux specific routines and constants for the client bootime setup stuff. -# -package liblocsetup; -use Exporter; -@ISA = "Exporter"; -@EXPORT = - qw ( $CP $EGREP $MOUNT $UMOUNT $TMPASSWD $SFSSD $SFSCD - os_cleanup_node os_ifconfig_line os_etchosts_line - os_setup os_groupadd os_useradd os_userdel os_usermod os_mkdir - os_rpminstall_line os_ifconfig_veth - os_routing_enable_forward os_routing_enable_gated - os_routing_add_manual os_routing_del_manual os_homedirdel - os_groupdel os_commitchanges - ); - -# Must come after package declaration! -use English; - -# Load up the paths. Its conditionalized to be compatabile with older images. -# Note this file has probably already been loaded by the caller. -BEGIN -{ - if (-e "/etc/emulab/paths.pm") { - require "/etc/emulab/paths.pm"; - import emulabpaths; - } - else { - my $ETCDIR = "/etc/rc.d/testbed"; - my $BINDIR = "/etc/rc.d/testbed"; - my $VARDIR = "/etc/rc.d/testbed"; - my $BOOTDIR = "/etc/rc.d/testbed"; - } -} - -# -# Various programs and things specific to win32/cygwin and that we want to export. -# -##$CP = "/bin/cp"; -##$EGREP = "/bin/egrep -q"; -#$MOUNT = "/bin/mount"; -#$UMOUNT = "/bin/umount"; -#$TMPASSWD = "$ETCDIR/passwd"; -#$SFSSD = "/usr/local/sbin/sfssd"; -#$SFSCD = "/usr/local/sbin/sfscd"; - -# -# These are not exported -# -#my $TMGROUP = "$ETCDIR/group"; -#my $TMSHADOW = "$ETCDIR/shadow"; -#my $TMGSHADOW = "$ETCDIR/gshadow"; -#my $USERADD = "/usr/sbin/useradd"; -#my $USERDEL = "/usr/sbin/userdel"; -#my $USERMOD = "/usr/sbin/usermod"; -#my $GROUPADD = "/usr/sbin/groupadd"; -#my $GROUPDEL = "/usr/sbin/groupdel"; -#my $IFCONFIG = "/sbin/ifconfig %s inet %s netmask %s"; -#my $IFC_100MBS = "100baseTx"; -#my $IFC_10MBS = "10baseT"; -#my $IFC_FDUPLEX = "FD"; -#my $IFC_HDUPLEX = "HD"; -my $RPMINSTALL = "/bin/rpm -i %s"; -#my @LOCKFILES = ("/etc/group.lock", "/etc/gshadow.lock"); -my $MKDIR = "/bin/mkdir"; -my $GATED = "/usr/sbin/gated"; -#my $ROUTE = "/sbin/route"; -my $SHELLS = "/etc/shells"; -#my $DEFSHELL = "/bin/tcsh"; - -# -# OS dependent part of cleanup node state. -# -sub os_cleanup_node ($) { -# my ($scrub) = @_; - -# unlink @LOCKFILES; - -# if (! $scrub) { -# return 0; -# } - -# printf STDOUT "Resetting passwd and group files\n"; -# if (system("$CP -f $TMGROUP $TMPASSWD /etc") != 0) { -# print STDERR "Could not copy default group file into place: $!\n"; -# exit(1); -# } - -# if (system("$CP -f $TMSHADOW $TMGSHADOW /etc") != 0) { -# print STDERR "Could not copy default passwd file into place: $!\n"; -# exit(1); -# } - - #RDC Should probably do stuff here - return 0; -} - -# -# Generate and return an ifconfig line that is approriate for putting -# into a shell script (invoked at bootup). -# -sub os_ifconfig_line($$$$$$;$) -{ - die "os_ifconfig_line not written"; -# my ($iface, $inet, $mask, $speed, $duplex, $aliases, $rtabid) = @_; -# my ($ifc, $miirest, $miisleep, $miisetspd, $media); - -# # -# # Need to check units on the speed. Just in case. -# # -# if ($speed =~ /(\d*)([A-Za-z]*)/) { -# if ($2 eq "Mbps") { -# $speed = $1; -# } -# elsif ($2 eq "Kbps") { -# $speed = $1 / 1000; -# } -# else { -# warn("*** Bad speed units in ifconfig!\n"); -# $speed = 100; -# } -# if ($speed == 100) { -# $media = $IFC_100MBS; -# } -# elsif ($speed == 10) { -# $media = $IFC_10MBS; -# } -# else { -# warn("*** Bad Speed in ifconfig!\n"); -# $media = $IFC_100MBS; -# } -# } -# if ($duplex eq "full") { -# $media = "$media-$IFC_FDUPLEX"; -# } -# elsif ($duplex eq "half") { -# $media = "$media-$IFC_HDUPLEX"; -# } -# else { -# warn("*** Bad duplex in ifconfig!\n"); -# $media = "$media-$IFC_FDUPLEX"; -# } - -# $ifc = "/sbin/mii-tool --force=$media $iface\n" . -# sprintf($IFCONFIG, $iface, $inet, $mask); - -# return "$ifc"; -} - -# -# Specialized function for configing locally hacked veth devices. -# -sub os_ifconfig_veth($$$$$;$$$) -{ - return ""; -} - -# -# Generate and return an string that is approriate for putting -# into /etc/hosts. -# -sub os_etchosts_line($$$) -{ -# my ($name, $ip, $aliases) = @_; - -# return sprintf("%s\t%s %s", $ip, $name, $aliases); -} - -my(%daGroups) = ( -'Administrators' => 'Administrators,Administrators have complete and unrestricted access to the computer/domain', -'Users' => 'Users,Users are prevented from making accidental or intentional system-wide changes. Thus, Users can run certified applications, but not most legacy applications', -'Remote Desktop Users' => 'Remote Desktop Users,Members in this group are granted the right to logon remotely' -); - -# -# Add a new group -# -sub os_groupadd($$) -{ - my($group, $gid) = @_; - - $daGroups{$gid} = "$group,group description"; - return 0; -} - -# -# Delete an old group -# -sub os_groupdel($) -{ -#RDC Right now we are doing nothing, The Addusers.exe program that I am currently using to add users -# does not support removing groups. -# my($group) = @_; - -# return system("$GROUPDEL $group"); -} - -# -# Remove a user account. -# -sub os_userdel($) -{ -#RDC Right now we are doing nothing, The Addusers.exe program that I am currently using to add users -# does not support removing users. -# my($login) = @_; - -# return system("$USERDEL $login"); -} - -# -# Modify user group membership. -# -sub os_usermod($$$$$$) -{ -#RDC MAJOR ERROR!!! Right now this function just silently fails. It should at least report a error that the -# code is not implemented under win32 -# my($login, $gid, $glist, $pswd, $root, $shell) = @_; - -# if ($root) { -# $glist = join(',', split(/,/, $glist), "root"); -# } -# if ($glist ne "") { -# $glist = "-G $glist"; -# } -# # Map the shell into a full path. -# $shell = MapShell($shell); - -# return system("$USERMOD -s $shell -g $gid $glist -p '$pswd' $login"); -} - -my %daUsers = (); -# -# Add a user. -# -sub os_useradd($$$$$$$$$) -{ - my($login, $uid, $gid, $pswd, $glist, $homedir, $gcos, $root, $shell) = @_; - my $plainTextPasswd = 'hackMe!'; - $daUsers{$login} = "$login,$login,$plainTextPasswd,,,,"; - print STDERR "message"; - foreach (split(",",$glist), $gid) { - if($daGroups{$_}) { - $daGroups{$_} = $daGroups{$_} . ",$login"; - } else { - print STDERR "gid->group name mapping for gid $_ not found"; - } - } - if ($root) { - $daGroups{Administrators} = $daGroups{Administrators} . ",$login"; - } else { - $daGroups{Users} = $daGroups{Users} . ",$login"; - $daGroups{'Remote Desktop Users'} = $daGroups{'Remote Desktop Users'} . ",$login"; - } - return 0; -} - -sub os_commitchanges() -{ -#This is a nop under Unix and does the work in Windows - -#open a file handle to /etc/testbed/accounts_to_create.txt - open(FOO, ">/etc/testbed/accounts_to_create.txt") or die "accounts_to_create could not open to write"; - print FOO "[Users]\n"; - foreach (values(%daUsers)) { - print FOO $_ . "\n"; - } - print FOO "\n[Global]\n"; #Meaning Global groups, this will be - #blank becuase we don't have a Domain - #Controller - print FOO "\n[Local]\n"; #Meaning local groups - #Format is as follows: - #,,,,... - foreach (values(%daGroups)) { - print FOO $_ . "\n"; - } - close(FOO); - #addusers.exe will only accept a DOS text file - system('unix2dos /etc/testbed/accounts_to_create.txt'); - #Now do the actual commit - print "Running addusers.exe...\n"; - system('addusers.exe /c c:\\\\cygwin\\\\etc\\\\testbed\\\\accounts_to_create.txt'); - print "addusers.exe done\n"; -} -# -# Remove a homedir. Might someday archive and ship back. -# -sub os_homedirdel($$) -{ - return 0; -} - -# -# Generate and return an RPM install line that is approriate for putting -# into a shell script (invoked at bootup). -# -sub os_rpminstall_line($) -{ - my ($rpm) = @_; - - return sprintf($RPMINSTALL, $rpm); -} - -# -# Create a directory including all intermediate directories. -# -sub os_mkdir($$) -{ - my ($dir, $mode) = @_; - - if (system("$MKDIR -p -m $mode $dir")) { - return 0; - } - return 1; -} - -# -# OS Dependent configuration. -# -sub os_setup() -{ - return 0; -} - -# -# OS dependent, routing-related commands -# -sub os_routing_enable_forward() -{ - my $cmd; - - $cmd = "sysctl -w net.ipv4.conf.all.forwarding=1"; - return $cmd; -} - -sub os_routing_enable_gated() -{ - my $cmd; - - # XXX hack to avoid gated dying mysteriously with TCP/611 already in use - $cmd = "sleep 3\n "; - $cmd .= "(ps alxww ; netstat -na) > /tmp/gated.state\n "; - $cmd .= "$GATED -f $BINDIR/gated_`$BINDIR/control_interface`.conf"; - return $cmd; -} - -sub os_routing_add_manual($$$$$;$) -{ - my ($routetype, $destip, $destmask, $gate, $cost, $rtabid) = @_; - my $cmd; - - if ($routetype eq "host") { - $cmd = "$ROUTE add -host $destip gw $gate"; - } elsif ($routetype eq "net") { - $cmd = "$ROUTE add -net $destip netmask $destmask gw $gate"; - } else { - warn "*** WARNING: bad routing entry type: $routetype\n"; - $cmd = ""; - } - - return $cmd; -} - -sub os_routing_del_manual($$$$$;$) -{ - my ($routetype, $destip, $destmask, $gate, $cost, $rtabid) = @_; - my $cmd; - - if ($routetype eq "host") { - $cmd = "$ROUTE delete -host $destip"; - } elsif ($routetype eq "net") { - $cmd = "$ROUTE delete -net $destip netmask $destmask gw $gate"; - } else { - warn "*** WARNING: bad routing entry type: $routetype\n"; - $cmd = ""; - } - - return $cmd; -} - -# Map a shell name to a full path using /etc/shells -sub MapShell($) -{ - my ($shell) = @_; - - if ($shell eq "") { - return $DEFSHELL; - } - - my $fullpath = `grep '/${shell}\$' $SHELLS`; - - if ($?) { - return $DEFSHELL; - } - - # Sanity Check - if ($fullpath =~ /^([-\w\/]*)$/) { - $fullpath = $1; - } - else { - $fullpath = $DEFSHELL; - } - return $fullpath; -} - -1; -- GitLab