MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //scripts.20110531.215904.25158/bsdcryptoinstall
#!/usr/bin/perl
# cpanel - bsdcryptoinstall                       Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel', '/scripts'; }

use Digest::MD5;
use cPanelBSDPKGS;
use Cpanel::OSSys;
my($system,$release,$machine) = (Cpanel::OSSys::uname())[0,2,4];


if (-e "/usr/lib/libcrypto.so") {
	exit();
}

my @GOODURLS;
if ($#SYSMIRRORLIST > -1) {
   @GOODURLS = @SYSMIRRORLIST;
} else {
   @GOODURLS = cPanelBSDPKGS::getmirrorlist();
   @SYSMIRRORLIST = @GOODURLS;
}


use Cpanel::OSSys;
my($sysname, $nodename, $release, $version, $machine) = Cpanel::OSSys::uname();

my $basedir = '/usr/home/crypto-install';

mkdir($basedir,0700);

my(@PKGS) = ("crypto");

foreach my $pkg (@PKGS) {
   mkdir("${basedir}/${pkg}",0700);
   getfile($pkg,$basedir,"CHECKSUM.MD5");
   open(BASE,"${basedir}/${pkg}/CHECKSUM.MD5");
   while(<BASE>) {
      /\S+\s*\(([^\)]+)\)\s*=\s*(\S+)/;
      my $file = $1;
      my $md5 = $2;
      if (!checkdigest($pkg,$basedir,$file,$md5)) {
         unlink("${basedir}/${pkg}/${file}");
         getfile($pkg,$basedir,$file);
      }
      if (!checkdigest($pkg,$basedir,$file,$md5)) {
         getfile($pkg,$basedir,$file);
      }
      if (!checkdigest($pkg,$basedir,$file,$md5)) {
         die "${file}: md5 check failed!";
      } else {
         print "${file}: md5 check passed!\n";
      }
   }
   close(BASE);

   chdir("${basedir}/${pkg}");
   chmod(0700,"install.sh");
   open(INS,"|./install.sh");
   print INS "y\n";
   close(INS);

}
system("/scripts/bsdldconfig");

sub getfile {
   my($pkg,$basedir,$file) = @_;
   foreach my $pkghost (@GOODURLS) {
      if ((stat("${basedir}/${pkg}/${file}"))[7] > 0) {
         last;
      }
      system("fetch","-o","${basedir}/${pkg}/${file}","${pkghost}/pub/FreeBSD/releases/i386/${release}/${pkg}/${file}");
      if ((stat("${basedir}/${pkg}/${file}"))[7] > 0) {
         last;
      }
   }
}


sub checkdigest {
   my($pkg,$basedir,$file,$md5) = @_;
   if (! -e "${basedir}/${pkg}/${file}") { return(0); }
   my $ctx = Digest::MD5->new;
   open(FILE,"${basedir}/${pkg}/${file}");
   $ctx->addfile(\*FILE);
   close(FILE);
   my $digest = $ctx->hexdigest;
   if ($digest eq $md5) {
      return(1);
   } else {
      return(0);
   }
}