- Timestamp:
- Sep 19, 2008 6:25:54 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 01073f7
- Parents:
- 9d207bd
- Location:
- fedkit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/fed-tun.pl
r9d207bd r7a8d667 21 21 use Sys::Hostname; 22 22 use IO::File; 23 use File::Copy; 23 24 24 25 my $IFCONFIG = "/sbin/ifconfig"; … … 29 30 my $ROUTE_GET = "/sbin/route get"; # XXX: works on FreeBSD, but should 30 31 # should be 'ip route get' for Linux 32 my $sshd_config = "/etc/ssh/sshd_config"; # Probably should be a param 31 33 32 34 # Ports that are forwarded between testbeds … … 71 73 my $remote_config_file; # Config file for the other side 72 74 73 if ($#ARGV != 0 && !getopts('df:r ', \%opts)) {75 if ($#ARGV != 0 && !getopts('df:rn', \%opts)) { 74 76 die "$usage"; 75 77 } … … 132 134 } 133 135 134 @ssh_port_fwds = () if ($opts{'type'} eq 'experiment'); 136 # -n just starts the ssh tap tunnel 137 @ssh_port_fwds = () if ($opts{'type'} eq 'experiment' || $opts{'n'}); 135 138 136 139 print "ssh_port_fwds = ", join("\n",@ssh_port_fwds), "\n" if ($debug); 137 140 } 141 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. 145 my $ports_on = 0; 146 147 my $conf = new IO::File($sshd_config) || die "Can't open $sshd_config: $!\n"; 148 my $new_conf = new IO::File(">/tmp/sshd_config") || 149 die "Can't open new ssh_config: $!\n"; 150 151 while(<$conf>) { 152 s/^\s*GatewayPorts.*/GatewayPorts yes/ && do { 153 print $new_conf $_ unless $ports_on++; 154 next; 155 }; 156 print $new_conf $_; 157 } 158 print $new_conf "GatewayPorts yes\n" unless $ports_on; 159 $conf->close(); 160 $new_conf->close(); 161 162 copy("/tmp/sshd_config", $sshd_config) || 163 die "Cannot replace $sshd_config: $!\n"; 164 165 system("/etc/rc.d/sshd restart"); 138 166 139 167 # Need these to make the Ethernet tap and bridge to work... -
fedkit/fed-tun.ucb.pl
r9d207bd r7a8d667 30 30 my $ROUTE_GET = "/sbin/route get"; # XXX: works on FreeBSD, but should 31 31 # should be 'ip route get' for Linux 32 my $sshd_config = "/etc/ssh/sshd_config"; # Probably should be a param 32 33 33 34 # Ports that are forwarded between testbeds … … 131 132 } 132 133 134 # Both sides need to have GatewayPorts to be set. Copy the existing 135 # sshd_config, making sure GatewayPorts is set to yes, replace the original, 136 # and restart sshd. 137 my $ports_on = 0; 138 139 my $conf = new IO::File($sshd_config) || die "Can't open $sshd_config: $!\n"; 140 my $new_conf = new IO::File(">/tmp/sshd_config") || 141 die "Can't open new ssh_config: $!\n"; 142 143 while(<$conf>) { 144 s/^\s*GatewayPorts.*/GatewayPorts yes/ && do { 145 print $new_conf $_ unless $ports_on++; 146 next; 147 }; 148 print $new_conf $_; 149 } 150 print $new_conf "GatewayPorts yes\n" unless $ports_on; 151 $conf->close(); 152 $new_conf->close(); 153 154 copy("/tmp/sshd_config", $sshd_config) || 155 die "Cannot replace $sshd_config: $!\n"; 156 157 system("/etc/rc.d/sshd restart"); 158 159 133 160 # Need these to make the Ethernet tap and bridge to work... 134 161
Note: See TracChangeset
for help on using the changeset viewer.