Skip to content

Commit

Permalink
Merge pull request #3 from rwf14f/master
Browse files Browse the repository at this point in the history
Perfsonar 3.5 updates and dependency fixes
  • Loading branch information
rwf14f committed Oct 14, 2015
2 parents 0c68c22 + 69ef84f commit 46c1d18
Show file tree
Hide file tree
Showing 10 changed files with 394 additions and 104 deletions.
22 changes: 22 additions & 0 deletions files/patches/01_perfsonar_webservice_auth.patch.3.5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- WebService/Auth.pm.org 2015-10-02 10:14:10.625379915 +0100
+++ WebService/Auth.pm 2015-10-02 13:40:13.356715712 +0100
@@ -1,3 +1,4 @@
+# puppet perfsonar::patches applied patch: 01_perfsonar_webservice_auth.patch.3.5.0
package perfSONAR_PS::NPToolkit::WebService::Auth;
use base 'Exporter';

@@ -8,10 +9,12 @@
my $cgi = shift;
my $authenticated = 0;
return if (! defined $cgi);
- if( defined $cgi->auth_type() && $cgi->auth_type ne '' && defined $cgi->remote_user() ){
+ my $auth_type = (defined $cgi->auth_type() && $cgi->auth_type ne '') ? $cgi->auth_type :
+ ((defined $ENV{SSL_CLIENT_VERIFY} && $ENV{SSL_CLIENT_VERIFY} eq 'SUCCESS') ? 'Certificate' : '');
+ if( $auth_type ne '' && defined $cgi->remote_user() ){
$authenticated = 1;
}
- return $authenticated;
+ return wantarray ? ($authenticated, $cgi->remote_user(), $auth_type) : $authenticated;
}

sub unauthorized_output {
120 changes: 120 additions & 0 deletions files/patches/02_perfsonar_webservice_pageauth.patch.3.5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
diff -Nur root.org/admin/host.cgi root/admin/host.cgi
--- root.org/admin/host.cgi 2015-10-02 10:23:09.329116608 +0100
+++ root/admin/host.cgi 2015-10-02 14:02:50.149557766 +0100
@@ -21,13 +21,8 @@
my $cgi = CGI->new();

my $section = 'host';
-my $remote_user = $cgi->remote_user();
-my $auth_type = '';

-if($cgi->auth_type()){
- $auth_type = $cgi->auth_type();
-}
-my $authenticated = is_authenticated($cgi);
+my ($authenticated, $remote_user, $auth_type) = is_authenticated($cgi);

if ( !$authenticated ) {
print unauthorized_output($cgi);
diff -Nur root.org/admin/index.cgi root/admin/index.cgi
--- root.org/admin/index.cgi 2015-10-02 10:23:09.330116611 +0100
+++ root/admin/index.cgi 2015-10-02 14:02:42.739559216 +0100
@@ -21,13 +21,8 @@
my $cgi = CGI->new();

my $section = 'admin';
-my $remote_user = $cgi->remote_user();
-my $auth_type = '';

-if($cgi->auth_type()){
- $auth_type = $cgi->auth_type();
-}
-my $authenticated = is_authenticated($cgi);
+my ($authenticated, $remote_user, $auth_type) = is_authenticated($cgi);

if ( !$authenticated ) {
print unauthorized_output($cgi);
diff -Nur root.org/admin/services.cgi root/admin/services.cgi
--- root.org/admin/services.cgi 2015-10-02 10:23:09.329116608 +0100
+++ root/admin/services.cgi 2015-10-02 14:02:59.016556034 +0100
@@ -21,20 +21,13 @@

my $section = 'services';

-my $authenticated = is_authenticated($cgi);
+my ($authenticated, $remote_user, $auth_type) = is_authenticated($cgi);

if ( !$authenticated ) {
print unauthorized_output($cgi);
exit;
}

-my $remote_user = $cgi->remote_user();
-my $auth_type = '';
-
-if($cgi->auth_type()) {
- $auth_type = $cgi->auth_type();
-}
-
my $full_url = url( -path=>1, -query=>1);
my $https_url = $full_url;
#if (!$full_url =~ /^https/) {
diff -Nur root.org/admin/tests.cgi root/admin/tests.cgi
--- root.org/admin/tests.cgi 2015-10-02 10:23:09.330116611 +0100
+++ root/admin/tests.cgi 2015-10-02 14:03:05.606554727 +0100
@@ -21,13 +21,8 @@
my $cgi = CGI->new();

my $section = 'tests';
-my $remote_user = $cgi->remote_user();
-my $auth_type = '';

-if($cgi->auth_type()){
- $auth_type = $cgi->auth_type();
-}
-my $authenticated = is_authenticated($cgi);
+my ($authenticated, $remote_user, $auth_type) = is_authenticated($cgi);

if ( !$authenticated ) {
print unauthorized_output($cgi);
diff -Nur root.org/index.cgi root/index.cgi
--- root.org/index.cgi 2015-10-02 10:23:09.329116608 +0100
+++ root/index.cgi 2015-10-02 13:41:15.866709369 +0100
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+# puppet perfsonar::patches applied patch: 02_perfsonar_webservice_pageauth.patch.3.5.0

use strict;
use warnings;
@@ -7,26 +8,20 @@
use Template;
#use POSIX;
use Data::Dumper;
-#use FindBin qw($RealBin);

# Set some variable to control the page layout
my $include_prefix = '';
my $sidebar = 1;

-#my $basedir = "$RealBin/../../..";
+use FindBin qw($RealBin);
+my $basedir = "$RealBin/../..";
+use lib "$RealBin/../../lib";

-#use lib "$RealBin/../../../../lib";
+use perfSONAR_PS::NPToolkit::WebService::Auth qw( is_authenticated );

my $cgi = CGI->new();

-my $remote_user = $cgi->remote_user();
-my $auth_type = '';
-
-if($cgi->auth_type()){
- $auth_type = $cgi->auth_type();
-}
-my $authenticated = 0;
-$authenticated = 1 if ($auth_type ne '');
+my ($authenticated, $remote_user, $auth_type) = is_authenticated($cgi);

my $full_url = url( -path=>1, -query=>1);
my $https_url = $full_url;
7 changes: 7 additions & 0 deletions lib/facter/perfsonar_systemenvironment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Facter.add(:perfsonar_systemenvironment) do
confine :osfamily => 'RedHat'
setcode do
ps_se = Facter::Util::Resolution::exec('/bin/rpm -q --qf "%{NAME}\n" perl-perfSONAR_PS-Toolkit-SystemEnvironment | grep "^perl-perfSONAR_PS-Toolkit-SystemEnvironment$"')
ps_se && !ps_se.empty? ? true : false
end
end
7 changes: 7 additions & 0 deletions lib/facter/perfsonar_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Facter.add(:perfsonar_version) do
confine :osfamily => 'RedHat'
setcode do
perfsonar = Facter::Util::Resolution::exec('/bin/rpm -q --qf "%{NAME} %{VERSION}\n" perl-perfSONAR_PS-Toolkit | grep "^perl-perfSONAR_PS-Toolkit "')
perfsonar.split(/ /)[1] if perfsonar
end
end
Loading

0 comments on commit 46c1d18

Please sign in to comment.