source: fedkit/active_config.pl @ 2b35261

axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change on this file since 2b35261 was 2b35261, checked in by Ted Faber <faber@…>, 14 years ago

Initial docs

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4
5use gateway_lib;
6
7use IO::File;
8
9use Getopt::Long;
10
11my $ssh_pubkey;
12my $ssh_privkey;
13my $tunnelip;
14my $peer;
15my $fedkit_dir= "/usr/local/federation";
16my $perl = "/usr/bin/perl";
17my $iface_file;
18my $ssh = "/usr/bin/ssh";
19
20exit(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
32my $tunnelparam = $tunnelip ? '--tunnelip' : '';
33
34system("$perl -I$fedkit_dir/lib $fedkit_dir/bin/prep_gateway.pl --peer=$peer " .
35    "--ssh_pubkey=$ssh_pubkey $tunnelparam");
36exit(20) if $?;
37
38my $f = new IO::File($iface_file) || die "Can't open $iface_file: $!\n";
39my $ifnum = 0;
40
41while (<$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();
56exit(0);
57
58=pod
59
60=head1 NAME
61
62B<active_config.pl> - Configure an active connectivity gateway under the DETER Federation Architecture
63
64=head1 OPTIONS
65
66=over 8
67
68=item B<fedkit=>I<install_dir>
69
70Directory in which this software is installed.  Generally not needed.
71
72=item B<interfaces=>I<interface table>
73
74A list of interfaces to forward data on of the form:
75
76=begin text
77
78iface ip_addr
79
80=end text
81
82The interface is the operating system name of the interface and the IP address
83is given in standard dotted decimal notation.  Other characters on a line are
84ignored.
85
86=item B<peer=>I<hostname>
87
88The other gateway providing forwarding.
89
90=item B<perl=>I<perl_binary>
91 
92Location of the perl binary.  Usually unneeded.
93
94=item B<ssh=>I<ssh_binary>
95
96The pathname of the ssh binary.  Unusally unnecessary.
97
98=item B<ssh_pubkey=>I<keyfile>
99
100A public to install as authorized.
101
102=item B<ssh_privkey=>I<identity_file>
103
104The identity to use for remote access
105
106=item B<tunnelip>
107
108True if the testbed uses the DETER tunnelip extension to provide external
109connectivity information
110
111=back
112
113=head1 SYNOPSIS
114
115B<active_config.pl> initiates the active side of the connectivity connection,
116which is to say that it:
117
118=over 4
119
120=item *
121
122Installs local keys and reconfigures that local ssh system to do link layer
123tunneling.
124
125=item *
126
127Starts a tunnel for each interface in the given interface table, both locally
128and remotely.
129
130=back
131
132=head1 AUTHORS
133
134Ted Faber <faber@isi.edu>
135
136=cut
Note: See TracBrowser for help on using the repository browser.