source: fedkit/prep_gateway.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: 1.7 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4
5use gateway_lib;
6
7use Getopt::Long;
8
9my $ssh_pubkey;
10my $tunnelip;
11my $peer;
12
13exit(20) unless GetOptions('ssh_pubkey=s' => \$ssh_pubkey,
14    'tunnelip' => \$tunnelip,
15    'peer=s' => \$peer,
16);
17
18gateway_lib::set_sshd_params( 
19    { 'GatewayPorts' => 'yes', 'PermitTunnel' => 'yes' } );
20system("/etc/rc.d/sshd restart");
21
22gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
23    if $ssh_pubkey;
24
25# Need these to make the Ethernet tap and bridge work.
26system("kldload /boot/kernel/bridgestp.ko") 
27    if -r "/boot/kernel/bridgestp.ko"; 
28system("kldload /boot/kernel/if_bridge.ko");
29system("kldload /boot/kernel/if_tap.ko");
30
31if ( $tunnelip ) {
32    my ($interface, $ip, $netmask, $mac, $router) = 
33        gateway_lib::deter_tunnelip();
34
35    gateway_lib::configure_outgoing_iface($interface, $ip, $netmask);
36    # Add the route to a peer.  Wait up to an hour for the peer's IP address to
37    # appear in the DNS.
38    gateway_lib::add_route($peer, $router, 1, 60 *60);
39}
40
41exit(0);
42
43=pod
44
45=head1 NAME
46
47B<prep_tunnel.pl> - Prepare a tunnel node for use as either a service or connectivity gateway.
48
49=head1 OPTIONS
50
51=over 8
52
53=item B<peer=>I<hostname>
54
55The other gateway providing forwarding.
56
57=item B<ssh_pubkey=>I<keyfile>
58
59A public to install as authorized.
60
61=item B<tunnelip>
62
63True if the testbed uses the DETER tunnelip extension to provide external
64connectivity information
65
66=back
67
68=head1 SYNOPSIS
69
70B<prep_gateway.pl> laods the necessary kernel modules for low-level bridging
71configures the local sshd to allow it, restarts that sshd, and installs the
72given key in root's authorized keys.
73
74If the gateway supports DETER gateway, it setablishes outside connectivity and
75adds a host rout to the given peer.
76
77=head1 AUTHORS
78
79Ted Faber <faber@isi.edu>
80
81=cut
Note: See TracBrowser for help on using the repository browser.