source: fedkit/combo.pl @ 4e9719b

axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change on this file since 4e9719b was 9b3627e, checked in by Ted Faber <faber@…>, 15 years ago

SEER support

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