Ignore:
Timestamp:
Mar 5, 2010 3:26:09 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
444790d
Parents:
c119839
Message:

More ProtoGENI accomodation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/prep_gateway.pl

    rc119839 rf8fa72b  
    66
    77use Getopt::Long;
     8use File::Copy;
     9use IO::File;
    810
    911my $ssh_pubkey;
     
    2022exit(20) unless GetOptions(%opts);
    2123
    22 gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts)
    23     if $use_file;
     24if ($use_file) {
     25    gateway_lib::read_config(gateway_lib::config_filename(), \%opts)
     26}
    2427
    25 gateway_lib::set_sshd_params(
    26     { 'GatewayPorts' => 'yes', 'PermitTunnel' => 'yes' } );
    27 system("/etc/rc.d/sshd restart");
     28my $uname = `uname`;
     29chomp $uname;
    2830
    29 gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
    30     if $ssh_pubkey;
     31if ($uname =~ /Linux/) {
     32    # Right now the only gateway nodes that are Linux nodes are ProtoGENI
     33    # nodes.  They need a bunch of custom updates to get into the 21st century,
     34    # but they are on the network.
     35    if ( -x '/usr/local/federation/bin/sshd' &&
     36            -e '/usr/local/federation/etc/sshd_config') {
     37        # Start our modern sshd if one is there
     38        system("/usr/local/federation/bin/sshd -p 20200 -f " .
     39            "/usr/local/federation/etc/sshd_config");
     40    }
     41    # fix yum.conf
     42    copy("/etc/yum.conf", "/etc/yum.conf.bak");
     43    my $from = new IO::File("/etc/yum.conf.bak");
     44    my $to = new IO::File(">/etc/yum.conf");
     45    while (<$from>) {
     46        s/download.fedoralegacy.org/fedoralegacy.lsu.edu/g;
     47        print $to $_;
     48    }
     49    $from->close();
     50    $to->close();
     51    # Now, bridging
     52    system('/usr/bin/yum -y install bridge-utils');
     53    #and keys
     54    gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
     55        if $ssh_pubkey;
     56}
     57elsif ($uname =~ /FreeBSD/ ){
     58    gateway_lib::set_sshd_params(
     59        { 'GatewayPorts' => 'yes', 'PermitTunnel' => 'yes' } );
     60    system("/etc/rc.d/sshd restart");
    3161
    32 # Need these to make the Ethernet tap and bridge work.
    33 system("kldload /boot/kernel/bridgestp.ko")
    34     if -r "/boot/kernel/bridgestp.ko";
    35 system("kldload /boot/kernel/if_bridge.ko");
    36 system("kldload /boot/kernel/if_tap.ko");
     62    gateway_lib::import_key($ssh_pubkey,'/root/.ssh/authorized_keys')
     63        if $ssh_pubkey;
     64
     65    # Need these to make the Ethernet tap and bridge work.
     66    system("kldload /boot/kernel/bridgestp.ko")
     67        if -r "/boot/kernel/bridgestp.ko";
     68    system("kldload /boot/kernel/if_bridge.ko");
     69    system("kldload /boot/kernel/if_tap.ko");
     70}
    3771
    3872if ( $tunnelip ) {
Note: See TracChangeset for help on using the changeset viewer.