Changeset 01073f7 for fedkit/fed-tun.pl


Ignore:
Timestamp:
Sep 22, 2008 2:15:46 PM (16 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
19cc408
Parents:
7a8d667
Message:

FreeBSD 7.0 compatibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/fed-tun.pl

    r7a8d667 r01073f7  
    2525my $IFCONFIG = "/sbin/ifconfig";
    2626my $TMCC = "/usr/local/etc/emulab/tmcc";
    27 my $SSH = "/usr/local/bin/ssh";
     27# If a special version of ssh is required, it will be installed in
     28# /usr/local/bin/ssh.  Otherwise use the usual one.
     29my $SSH = -x "/usr/local/bin/ssh" ? "/usr/local/bin/ssh" : "/usr/bin/ssh";
    2830my $NC = "/usr/bin/nc";
    2931my $SSH_PORT = 22;
     
    4345                                            # dodge the port on the
    4446                                            # remote tunnel node.
     47die "Cannot exec $SSH" unless -x $SSH;
     48
    4549sub setup_bridging;
    4650sub setup_tunnel_cfg;
     
    140144}
    141145
    142 # Both sides need to have GatewayPorts to be set.  Copy the existing
    143 # sshd_config, making sure GatewayPorts is set to yes, replace the original,
    144 # and restart sshd.
     146# Both sides need to have GatewayPorts and PermitTunnel set.  Copy the existing
     147# sshd_config, making sure GatewayPorts and PermitTunnel are set to yes,
     148# replace the original, and restart sshd.
    145149my $ports_on = 0;
     150my $tunnel_on = 0;
    146151
    147152my $conf = new IO::File($sshd_config) || die "Can't open $sshd_config: $!\n";
     
    154159        next;
    155160    };
     161    s/^\s*PermitTunnel.*/PermitTunnel yes/ && do {
     162        print $new_conf $_ unless $tunnel_on++;
     163        next;
     164    };
    156165    print $new_conf $_;
    157166}
    158167print $new_conf "GatewayPorts yes\n" unless $ports_on;
     168print $new_conf "PermitTunnel yes\n" unless $tunnel_on;
    159169$conf->close();
    160170$new_conf->close();
     
    166176
    167177# Need these to make the Ethernet tap and bridge to work...
    168 
     178system("kldload /boot/kernel/bridgestp.ko")
     179    if -r "/boot/kernel/bridgestp.ko";
    169180system("kldload /boot/kernel/if_bridge.ko");
    170181system("kldload /boot/kernel/if_tap.ko");
     
    240251            system("$cmd"); # or die "Failed to run ssh";
    241252        }
    242         $cmd =  "$SSH -w $count:$count -o \"StrictHostKeyChecking no\" " .
     253        # The Tunnel option specifies the level to tunnel at.  Ethernet creates
     254        # a tap device rather than a tun device.  Strict host key checking
     255        # avoids asking the user to OK a strange host key.
     256        $cmd =  "$SSH -w $count:$count -o \"Tunnel ethernet\" " .
     257            "-o \"StrictHostKeyChecking no\" " .
    243258            "$opts{'peer'}  \"$remote_script_dir/fed-tun.pl " .
    244259            "$remote_config_file -r $addr $count\" & |";
Note: See TracChangeset for help on using the changeset viewer.