- Timestamp:
- Feb 10, 2010 10:29:18 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- bbd0039
- Parents:
- b73cc45
- Location:
- fedkit
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
fedkit/Makefile
rb73cc45 r8d4e4fb 1 1 BINARIES=federate.sh smbmount.FreeBSD.pl smbmount.Linux.pl \ 2 2 make_hosts fed-tun.pl fed_evrepeater rc.fedaccounts \ 3 config_from_tunnelip.pl active_config.pl combo _active.pl \3 config_from_tunnelip.pl active_config.pl combo.pl \ 4 4 prep_gateway.pl port_forward.pl setup_bridge.pl 5 5 6 6 LIBRARIES=gateway_lib.pm 7 7 8 fedkit.tgz: ${ BINARIES} ${PATCHES}8 fedkit.tgz: ${LIBRARIES} ${BINARIES} ${PATCHES} 9 9 mkdir -p /tmp/fedkit/local/federation/bin 10 10 mkdir -p /tmp/fedkit/local/federation/lib -
fedkit/active_config.pl
rb73cc45 r8d4e4fb 15 15 my $fedkit_dir= "/usr/local/federation"; 16 16 my $perl = "/usr/bin/perl"; 17 my $iface_file ;17 my $iface_file = "/var/emulab/boot/ifmap"; 18 18 my $ssh = "/usr/bin/ssh"; 19 my $use_file; 19 20 20 exit(20) unless GetOptions(21 my %opts = ( 21 22 'ssh_pubkey=s' => \$ssh_pubkey, 22 23 'ssh_privkey=s' => \$ssh_privkey, … … 27 28 'interfaces=s' => \$iface_file, 28 29 'ssh=s' => \$ssh, 30 'use_file' => \$use_file, 29 31 ); 30 32 33 exit(20) unless GetOptions(%opts); 34 35 gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts) 36 if $use_file; 31 37 32 38 my $tunnelparam = $tunnelip ? '--tunnelip' : ''; … … 109 115 connectivity information 110 116 117 =item B<use_file> 118 119 If given read additional parameters from the file in 120 /proj/I<project>/exp/I<experiment/tmp/I<hostname>.gw/conf where those are the 121 current testbed project and experiment and the hostname is before the first 122 dot. The file is option: value. 123 124 111 125 =back 112 126 -
fedkit/combo.pl
rb73cc45 r8d4e4fb 11 11 my $ssh_pubkey; 12 12 my $ssh_privkey; 13 my $active; 13 14 my $tunnelip; 14 15 my $peer; 15 16 my $fedkit_dir= "/usr/local/federation"; 16 17 my $perl = "/usr/bin/perl"; 17 my $iface_file ;18 my $iface_file = "/var/emulab/boot/ifmap"; 18 19 my $ssh = "/usr/bin/ssh"; 19 20 my @ports; 21 my $use_file; 20 22 21 exit(20) unless GetOptions(23 my %opts = ( 22 24 'ssh_pubkey=s' => \$ssh_pubkey, 23 25 'ssh_privkey=s' => \$ssh_privkey, … … 28 30 'interfaces=s' => \$iface_file, 29 31 'ssh=s' => \$ssh, 30 'port=s', \@ports, 32 'port=s' => \@ports, 33 'active' => \$active, 34 'use_file' => \$use_file, 31 35 ); 32 36 37 exit(20) unless GetOptions(%opts); 38 39 gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts) 40 if $use_file; 33 41 34 42 my $tunnelparam = $tunnelip ? '--tunnelip' : ''; 35 my $portparam = join(" --port=", @ports); 43 if ($active) { 44 my $portparam = join(" --port=", @ports); 36 45 37 # join doesn't prefix the first one38 $portparam="--port=$portparam" if $portparam;46 # join doesn't prefix the first one 47 $portparam="--port=$portparam" if $portparam; 39 48 40 system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/active_config.pl " .41 42 43 44 exit(20) if $?;49 system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/active_config.pl " . 50 "--peer=$peer --ssh_pubkey=$ssh_pubkey --ssh_privkey=$ssh_privkey " . 51 " $tunnelparam --fedkit=$fedkit_dir --perl=$perl " . 52 "--ssh=$ssh --interfaces=$iface_file"); 53 exit(20) if $?; 45 54 46 system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/port_forward.pl " . 47 "--peer=$peer --ssh_pubkey=$ssh_pubkey --ssh_privkey=$ssh_privkey " . 48 " $tunnelparam --fedkit=$fedkit_dir --perl=$perl " . 49 "--ssh=$ssh $portparam"); 50 exit(20) if $?; 55 system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/port_forward.pl " . 56 "--peer=$peer --ssh_pubkey=$ssh_pubkey --ssh_privkey=$ssh_privkey " . 57 " $tunnelparam --fedkit=$fedkit_dir --perl=$perl " . 58 "--ssh=$ssh $portparam"); 59 exit(20) if $?; 60 } 61 else { 62 system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/prep_gateway.pl " . 63 "--peer=$peer --ssh_pubkey=$ssh_pubkey $tunnelparam"); 64 exit(20) if $?; 65 } 51 66 52 67 =pod … … 108 123 connectivity information 109 124 125 =item B<use_file> 126 127 If given read additional parameters from the file in 128 /proj/I<project>/exp/I<experiment/tmp/I<hostname>.gw/conf where those are the 129 current testbed project and experiment and the hostname is before the first 130 dot. The file is option: value. 131 110 132 =back 111 133 -
fedkit/gateway_lib.pm
rb73cc45 r8d4e4fb 9 9 @EXPORT_OK=qw(set_sshd_params import_key wait_for_DNS deter_tunnelip 10 10 configure_outgoing_iface add_route bind_tap_to_iface iface_to_addr 11 dest_to_iface addr_to_iface); 11 dest_to_iface addr_to_iface read_config emulab_config_filename); 12 12 13 13 14 use strict; … … 24 25 my $TMCC = "/usr/local/etc/emulab/tmcc"; 25 26 my $FINDIF = "/usr/local/etc/emulab/findif"; 27 my $TMCC = "/usr/local/etc/emulab/tmcc"; 26 28 27 29 # Takes an ssh config file and a reference to a hash of keys whose values must … … 242 244 } 243 245 246 # untested 247 sub read_config { 248 my($file, $map) = @_; 249 my %param; 250 my %keywords; 251 my $f; 252 253 foreach my $k (keys %{$map}) { 254 if ( $k =~ /(\S+)=[si]/ ) { 255 $keywords{$1} = $map->{$k}; 256 $param{$1}++; 257 } 258 else { 259 $keywords{$k} = $map->{$k}; 260 } 261 } 262 263 $f = new IO::File($file) || die "Can't open $file: $!\n"; 264 while (<$f>) { 265 /^\s*([^:]+):\s*(.*)/ && do { 266 my $keyw = $1; 267 my $val = $2; 268 269 $keyw =~ tr [A-Z] [a-z]; 270 271 if ($keywords{$keyw} ) { 272 if ( $param{$keyw} ) { 273 if ( ref($keywords{$keyw}) eq 'SCALAR') { 274 ${$keywords{$keyw}} = $val; 275 } 276 elsif( ref($keywords{$keyw}) eq 'ARRAY') { 277 push(@{$keywords{$keyw}}, $val); 278 } 279 else { 280 die "Unknown variable type for $keyw\n"; 281 } 282 } 283 else { ${$keywords{$keyw}}++; } 284 } 285 next; 286 }; 287 } 288 $f->close(); 289 } 290 291 292 sub emulab_config_filename { 293 # Find the configuration file in the usual place, which depends on what 294 # experiment and project we're in. 295 my $pid; 296 my $eid; 297 my $filename; 298 my $tmcd = new IO::Pipe() || die "Can't create pipe: $!\n"; 299 300 $tmcd->reader("$TMCC status"); 301 302 while (<$tmcd>) { 303 chomp; 304 /ALLOCATED=([^\/]+)\/(\S+)/ && do { 305 $pid = $1; 306 $eid = $2; 307 }; 308 } 309 $tmcd->close(); 310 my $hn = `hostname`; 311 chomp $hn; 312 $hn =~ s/\..*//; 313 $filename = "/proj/$pid/exp/$eid/tmp/$hn.gw.conf" 314 if $pid and $eid; 315 316 return $filename; 317 } 318 244 319 1; -
fedkit/prep_gateway.pl
rb73cc45 r8d4e4fb 10 10 my $tunnelip; 11 11 my $peer; 12 13 exit(20) unless GetOptions('ssh_pubkey=s' => \$ssh_pubkey, 12 my $use_file; 13 my %opts = ( 14 'ssh_pubkey=s' => \$ssh_pubkey, 14 15 'tunnelip' => \$tunnelip, 15 16 'peer=s' => \$peer, 17 'use_file' => \$use_file, 16 18 ); 19 20 exit(20) unless GetOptions(%opts); 21 22 gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts) 23 if $use_file; 17 24 18 25 gateway_lib::set_sshd_params( … … 64 71 connectivity information 65 72 73 =item B<use_file> 74 75 If given read additional parameters from the file in 76 /proj/I<project>/exp/I<experiment/tmp/I<hostname>.gw/conf where those are the 77 current testbed project and experiment and the hostname is before the first 78 dot. The file is option: value. 79 80 66 81 =back 67 82
Note: See TracChangeset
for help on using the changeset viewer.