source: fedkit/combo.pl @ 641bb66

axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change on this file since 641bb66 was 8d4e4fb, checked in by Ted Faber <faber@…>, 15 years ago

Add support for parameters via files in a standard emulab location

Also moved combo_active.pl to combo.pl and added support for passive gateways.

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[2edec46]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;
[8d4e4fb]13my $active;
[2edec46]14my $tunnelip;
15my $peer;
16my $fedkit_dir= "/usr/local/federation";
17my $perl = "/usr/bin/perl";
[8d4e4fb]18my $iface_file = "/var/emulab/boot/ifmap";
[2edec46]19my $ssh = "/usr/bin/ssh";
20my @ports;
[8d4e4fb]21my $use_file;
[2edec46]22
[8d4e4fb]23my %opts = (
[2edec46]24    'ssh_pubkey=s' => \$ssh_pubkey,
25    'ssh_privkey=s' => \$ssh_privkey,
26    'tunnelip' => \$tunnelip,
27    'peer=s' => \$peer,
28    'fedkit=s' => \$fedkit_dir,
29    'perl=s' => \$perl,
30    'interfaces=s' => \$iface_file,
31    'ssh=s' => \$ssh,
[8d4e4fb]32    'port=s' => \@ports,
33    'active' => \$active, 
34    'use_file' => \$use_file,
[2edec46]35);
36
[8d4e4fb]37exit(20) unless GetOptions(%opts);
[2edec46]38
[8d4e4fb]39gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts)
40    if $use_file;
[2edec46]41
[8d4e4fb]42my $tunnelparam = $tunnelip ? '--tunnelip' : '';
43if ($active) {
44    my $portparam = join(" --port=", @ports);
45
46    # join doesn't prefix the first one
47    $portparam="--port=$portparam" if $portparam;
48
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 $?;
54
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}
61else {
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}
[2b35261]66
67=pod
68
69=head1 NAME
70
71B<combo_active.pl> - Do both the active configuration of a connectiveity gateway and service port forwarding.
72
73=head1 OPTIONS
74
75=over 8
76
77=item B<fedkit=>I<install_dir>
78
79Directory in which this software is installed.  Generally not needed.
80
81=item B<interfaces=>I<interface table>
82
83A list of interfaces to forward data on of the form:
84
85=begin text
86
87iface ip_addr
88
89=end text
90
91The interface is the operating system name of the interface and the IP address
92is given in standard dotted decimal notation.  Other characters on a line are
93ignored.
94
95=item B<peer=>I<hostname>
96
97The other gateway providing forwarding.
98
99=item B<perl=>I<perl_binary>
100 
101Location of the perl binary.  Usually unneeded.
102
103=item B<port=>I<port_spec>
104
105Forward the given port.  The port is specified as
106for B<port_forward.pl>
107
108=item B<ssh=>I<ssh_binary>
109
110The pathname of the ssh binary.  Unusally unnecessary.
111
112=item B<ssh_pubkey=>I<keyfile>
113
114A public to install as authorized.
115
116=item B<ssh_privkey=>I<identity_file>
117
118The identity to use for remote access
119
120=item B<tunnelip>
121
122True if the testbed uses the DETER tunnelip extension to provide external
123connectivity information
124
[8d4e4fb]125=item B<use_file>
126
127If given read additional parameters from the file in
128/proj/I<project>/exp/I<experiment/tmp/I<hostname>.gw/conf where those are the
129current testbed project and experiment and the hostname is before the first
130dot.  The file is option: value.
131
[2b35261]132=back
133
134=head1 SYNOPSIS
135
136Call B<active_config.pl> and B<port_forward.pl> with the relevant parameters.
137
138
139=head1 AUTHORS
140
141Ted Faber <faber@isi.edu>
142
143=cut
Note: See TracBrowser for help on using the repository browser.