source:
fedkit/prep_gateway.pl
@
2edec46
Last change on this file since 2edec46 was 2edec46, checked in by , 14 years ago | |
---|---|
|
|
File size: 1019 bytes |
Line | |
---|---|
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | |
5 | use gateway_lib; |
6 | |
7 | use Getopt::Long; |
8 | |
9 | my $ssh_pubkey; |
10 | my $tunnelip; |
11 | my $peer; |
12 | |
13 | exit(20) unless GetOptions('ssh_pubkey=s' => \$ssh_pubkey, |
14 | 'tunnelip' => \$tunnelip, |
15 | 'peer=s' => \$peer, |
16 | ); |
17 | |
18 | gateway_lib::set_sshd_params( |
19 | { 'GatewayPorts' => 'yes', 'PermitTunnel' => 'yes' } ); |
20 | system("/etc/rc.d/sshd restart"); |
21 | |
22 | gateway_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. |
26 | system("kldload /boot/kernel/bridgestp.ko") |
27 | if -r "/boot/kernel/bridgestp.ko"; |
28 | system("kldload /boot/kernel/if_bridge.ko"); |
29 | system("kldload /boot/kernel/if_tap.ko"); |
30 | |
31 | if ( $tunnelip ) { |
32 | my ($interface, $ip, $netmask, $mac, $router) = |
33 | gateway_lib::deter_tunnelip(); |
34 | |
35 | gateway_lib::configure_outgoing_iface($interface, $ip, $netmask, $mac); |
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 | |
41 | exit(0); |
Note: See TracBrowser
for help on using the repository browser.