TBConfig.pm.in 1.96 KB
Newer Older
Mike Hibler's avatar
Mike Hibler committed
1 2
#
# Copyright (c) 2009 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Mike Hibler's avatar
Mike Hibler committed
22
#
Kevin Tew's avatar
Kevin Tew committed
23
package TBConfig;
24 25

use SemiModern::Perl;
26 27 28 29
use Crypt::X509;
use Tools qw(slurp);
use Data::Dumper;
use MIME::Base64;
Kevin Tew's avatar
Kevin Tew committed
30

Kevin Tew's avatar
Kevin Tew committed
31
our $XMLRPC_SERVER    = $ENV{'TBTS_XMLRPC_URL'} || "https://boss.emulab.net:3069/usr/testbed";
Kevin Tew's avatar
Kevin Tew committed
32
our $OPS_SERVER       = "users.emulab.net";
33
our $XMLRPC_VERSION   = "0.1";
34
our $XMLRPC_SERVER_TIMEOUT = 60 * 10;  #seconds
35
our $SSL_CLIENT_CERT  = glob("~/.ssl/emulab.cert");
Kevin Tew's avatar
Kevin Tew committed
36
our $SSL_CLIENT_KEY   = glob("~/.ssl/decrypted_emulab.key");
37
our $EMULAB_USER      = get_emulab_user();
Kevin Tew's avatar
Kevin Tew committed
38
our $DEFAULT_PID      = $ENV{'TBTS_PROJECT'} || 'tbtest';
39 40 41
our $DEFAULT_GID      = $ENV{'TBTS_GROUP'}   || '';
our $DEBUG_XML_CLIENT = $ENV{'TBTS_DEBUG'}   || 0;
our $CMDLINE_OPTIONS  = {};
42 43 44 45
our @EXPERIMENT_OPS_PARAMS = ('noemail' => 1);
our $concurrent_prerun_jobs = 4;
our $concurrent_node_usage  = 20;
our $EMULAB_SUFFIX    = "emulab.net";
Kevin Tew's avatar
Kevin Tew committed
46 47 48
our $cmdline_defines  = {};
our $exclude_steps    = qw();
our $runonly;
Kevin Tew's avatar
Kevin Tew committed
49

50 51 52 53 54 55 56 57 58
sub get_emulab_user {
  my $cert = slurp($SSL_CLIENT_CERT);
  $cert =~ s/^-----BEGIN CERTIFICATE-----//;
  $cert =~ s/-----END CERTIFICATE-----//;
  $cert = decode_base64($cert);
  $cert = Crypt::X509->new(cert => $cert);
  my $user = $cert->subject_ou;
  $user =~ /.*\.(.*)/;
  $1
Kevin Tew's avatar
Kevin Tew committed
59 60 61
}

1;