[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 | my @ports; |
---|
| 20 | |
---|
| 21 | exit(20) unless GetOptions( |
---|
| 22 | 'ssh_pubkey=s' => \$ssh_pubkey, |
---|
| 23 | 'ssh_privkey=s' => \$ssh_privkey, |
---|
| 24 | 'tunnelip' => \$tunnelip, |
---|
| 25 | 'peer=s' => \$peer, |
---|
| 26 | 'fedkit=s' => \$fedkit_dir, |
---|
| 27 | 'perl=s' => \$perl, |
---|
| 28 | 'interfaces=s' => \$iface_file, |
---|
| 29 | 'ssh=s' => \$ssh, |
---|
| 30 | 'port=s', \@ports, |
---|
| 31 | ); |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | my $tunnelparam = $tunnelip ? '--tunnelip' : ''; |
---|
| 35 | my $portparam = join(" --port=", @ports); |
---|
| 36 | |
---|
| 37 | # join doesn't prefix the first one |
---|
| 38 | $portparam="--port=$portparam" if $portparam; |
---|
| 39 | |
---|
| 40 | system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/active_config.pl " . |
---|
| 41 | "--peer=$peer --ssh_pubkey=$ssh_pubkey --ssh_privkey=$ssh_privkey " . |
---|
| 42 | " $tunnelparam --fedkit=$fedkit_dir --perl=$perl " . |
---|
| 43 | "--ssh=$ssh --interfaces=$iface_file"); |
---|
| 44 | exit(20) if $?; |
---|
| 45 | |
---|
| 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 $?; |
---|
[2b35261] | 51 | |
---|
| 52 | =pod |
---|
| 53 | |
---|
| 54 | =head1 NAME |
---|
| 55 | |
---|
| 56 | B<combo_active.pl> - Do both the active configuration of a connectiveity gateway and service port forwarding. |
---|
| 57 | |
---|
| 58 | =head1 OPTIONS |
---|
| 59 | |
---|
| 60 | =over 8 |
---|
| 61 | |
---|
| 62 | =item B<fedkit=>I<install_dir> |
---|
| 63 | |
---|
| 64 | Directory in which this software is installed. Generally not needed. |
---|
| 65 | |
---|
| 66 | =item B<interfaces=>I<interface table> |
---|
| 67 | |
---|
| 68 | A list of interfaces to forward data on of the form: |
---|
| 69 | |
---|
| 70 | =begin text |
---|
| 71 | |
---|
| 72 | iface ip_addr |
---|
| 73 | |
---|
| 74 | =end text |
---|
| 75 | |
---|
| 76 | The interface is the operating system name of the interface and the IP address |
---|
| 77 | is given in standard dotted decimal notation. Other characters on a line are |
---|
| 78 | ignored. |
---|
| 79 | |
---|
| 80 | =item B<peer=>I<hostname> |
---|
| 81 | |
---|
| 82 | The other gateway providing forwarding. |
---|
| 83 | |
---|
| 84 | =item B<perl=>I<perl_binary> |
---|
| 85 | |
---|
| 86 | Location of the perl binary. Usually unneeded. |
---|
| 87 | |
---|
| 88 | =item B<port=>I<port_spec> |
---|
| 89 | |
---|
| 90 | Forward the given port. The port is specified as |
---|
| 91 | for B<port_forward.pl> |
---|
| 92 | |
---|
| 93 | =item B<ssh=>I<ssh_binary> |
---|
| 94 | |
---|
| 95 | The pathname of the ssh binary. Unusally unnecessary. |
---|
| 96 | |
---|
| 97 | =item B<ssh_pubkey=>I<keyfile> |
---|
| 98 | |
---|
| 99 | A public to install as authorized. |
---|
| 100 | |
---|
| 101 | =item B<ssh_privkey=>I<identity_file> |
---|
| 102 | |
---|
| 103 | The identity to use for remote access |
---|
| 104 | |
---|
| 105 | =item B<tunnelip> |
---|
| 106 | |
---|
| 107 | True if the testbed uses the DETER tunnelip extension to provide external |
---|
| 108 | connectivity information |
---|
| 109 | |
---|
| 110 | =back |
---|
| 111 | |
---|
| 112 | =head1 SYNOPSIS |
---|
| 113 | |
---|
| 114 | Call B<active_config.pl> and B<port_forward.pl> with the relevant parameters. |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | =head1 AUTHORS |
---|
| 118 | |
---|
| 119 | Ted Faber <faber@isi.edu> |
---|
| 120 | |
---|
| 121 | =cut |
---|