source: fedkit/combo.pl @ c5b28bf

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

More ProtoGENI accomodation

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