axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change
on this file since 2edec46 was
2edec46,
checked in by Ted Faber <faber@…>, 14 years ago
|
Factored gateway implementation. Initial import.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[2edec46] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | |
---|
| 5 | use gateway_lib; |
---|
| 6 | |
---|
| 7 | use IO::File; |
---|
| 8 | |
---|
| 9 | use Getopt::Long; |
---|
| 10 | |
---|
| 11 | my $ssh_pubkey; |
---|
| 12 | my $ssh_privkey; |
---|
| 13 | my $tunnelip; |
---|
| 14 | my $peer; |
---|
| 15 | my $fedkit_dir= "/usr/local/federation"; |
---|
| 16 | my $perl = "/usr/bin/perl"; |
---|
| 17 | my $iface_file; |
---|
| 18 | my $ssh = "/usr/bin/ssh"; |
---|
| 19 | |
---|
| 20 | exit(20) unless GetOptions( |
---|
| 21 | 'ssh_pubkey=s' => \$ssh_pubkey, |
---|
| 22 | 'ssh_privkey=s' => \$ssh_privkey, |
---|
| 23 | 'tunnelip' => \$tunnelip, |
---|
| 24 | 'peer=s' => \$peer, |
---|
| 25 | 'fedkit=s' => \$fedkit_dir, |
---|
| 26 | 'perl=s' => \$perl, |
---|
| 27 | 'interfaces=s' => \$iface_file, |
---|
| 28 | 'ssh=s' => \$ssh, |
---|
| 29 | ); |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | my $tunnelparam = $tunnelip ? '--tunnelip' : ''; |
---|
| 33 | |
---|
| 34 | system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/prep_gateway.pl --peer=$peer " . |
---|
| 35 | "--ssh_pubkey=$ssh_pubkey $tunnelparam"); |
---|
| 36 | exit(20) if $?; |
---|
| 37 | |
---|
| 38 | my $f = new IO::File($iface_file) || die "Can't open $iface_file: $!\n"; |
---|
| 39 | my $ifnum = 0; |
---|
| 40 | |
---|
| 41 | while (<$f>) { |
---|
| 42 | /([[:alnum:]]+)\s+([\d\.]+)/ && do { |
---|
| 43 | my ($iface, $addr) = ($1, $2); |
---|
| 44 | |
---|
| 45 | my $cmd = "$ssh -w $ifnum:$ifnum -o \"Tunnel ethernet\" " . |
---|
| 46 | "-o \"StrictHostKeyChecking no\" -i $ssh_privkey " . |
---|
| 47 | "$peer perl -I$fedkit_dir/lib $fedkit_dir/bin/setup_bridge.pl " . |
---|
| 48 | "--tapno=$ifnum --dest=$addr &"; |
---|
| 49 | system($cmd); |
---|
| 50 | die if $?; |
---|
| 51 | gateway_lib::bind_tap_to_iface($ifnum, $iface, $addr); |
---|
| 52 | $ifnum++; |
---|
| 53 | }; |
---|
| 54 | } |
---|
| 55 | $f->close(); |
---|
| 56 | exit(0); |
---|
Note: See
TracBrowser
for help on using the repository browser.