Skip to content

Commit 4e5b406

Browse files
Merge pull request #101 from ericvaandering/cern_shib2
Cern shib2
2 parents 1c2c482 + 65435c8 commit 4e5b406

7 files changed

Lines changed: 191 additions & 11 deletions

File tree

DocDB/cgi/DocDBVersion.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
# along with DocDB; if not, write to the Free Software
2222
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2323

24-
$DocDBVersion = "8.8.10b1";
24+
$DocDBVersion = "8.8.11";
2525

2626
1;

DocDB/cgi/ShibbolethUtilities.pm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ sub FetchSecurityGroupsForShib (%) {
4242

4343
# Otherwise map shibboleth groups to DocDB groups
4444

45-
push @DebugStack,"Setting DocDB groups from shibboleth groups";
46-
my @ShibGroups = split /;/,$ENV{ADFS_GROUP};
45+
push @DebugStack,"Setting DocDB groups from shibboleth groups ".$ENV{CERN_ROLES};
46+
my @ShibGroups = split /;/,$ENV{CERN_ROLES};
4747

4848
foreach my $ShibGroup (@ShibGroups) {
4949
if ($ShibGroupMap{$ShibGroup}) {
@@ -59,7 +59,7 @@ sub FetchSecurityGroupsForShib (%) {
5959
}
6060

6161
sub FetchEmailUserIDForShib () {
62-
my $ShibName = $ENV{ADFS_LOGIN};
62+
my $ShibName = $ENV{CERN_LOGIN};
6363
push @DebugStack,"Finding EmailUserID by shibboleth name $ShibName";
6464

6565
my $EmailUserSelect = $dbh->prepare("select EmailUserID from EmailUser ".
@@ -103,10 +103,10 @@ sub GetUserInfoShib() {
103103
my $EmailAddress = "Unknown";
104104
my $Name = "Unknown";
105105

106-
if (exists $ENV{'ADFS_LOGIN'}) {
107-
$Name = $ENV{ADFS_FULLNAME};
108-
$EmailAddress = $ENV{ADFS_EMAIL};
109-
$Username = $ENV{ADFS_LOGIN};
106+
if (exists $ENV{'CERN_LOGIN'}) {
107+
$Name = $ENV{CERN_FULLNAME};
108+
$EmailAddress = $ENV{CERN_EMAIL};
109+
$Username = $ENV{CERN_LOGIN};
110110
}
111111

112112
push @DebugStack, "GetUserInfoShib returning $Username, $Username, $EmailAddress, $Name";

DocDB/scripts/CheckModules

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ my @Modules = (
3030
"CGI::Untaint",
3131
"Cwd",
3232
"DateTime",
33-
"Digest::SHA",
33+
"Digest::SHA1",
3434
"DBI",
3535
"File::Find",
3636
"File::MimeInfo",
3737
"Getopt::Std",
3838
"Mail::Send",
3939
"Mail::Mailer",
4040
"Time::Local",
41-
"XML::Grove::AsCanonXML",
42-
"XML::Grove::AsString",
4341
"XML::Parser::PerlSAX",
4442
"XML::PatAct::MatchName",
4543
"XML::PatAct::ToObjects",

docker/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM cern/cc7-base:latest
2+
3+
RUN yum upgrade -y && \
4+
yum clean all && \
5+
rm -rf /var/cache/yum
6+
7+
RUN yum install -y httpd mod_ssl \
8+
sudo git \
9+
perl perl-CPAN perl-CGI perl-DBI perl-DBD-MySQL perl-DateTime perl-File-MimeInfo \
10+
perl-MailTools perl-XML-Twig perl-libxml-perl perl-DateTime-Format-ICal perl-libwww-perl \
11+
perl-Data-ICal python-pip perl-Digest-SHA1 \
12+
sendmail sendmail-cf \
13+
&& yum clean all \
14+
&& rm -rf /var/cache/yum
15+
16+
# Jobber is a lightweight cron replacement written in Go
17+
RUN rpm -i https://github.com/dshearer/jobber/releases/download/v1.4.4/jobber-1.4.4-1.el8.x86_64.rpm
18+
19+
# j2cli is used for templating config files which will be useful for passing environment variables
20+
RUN pip install --no-cache-dir --upgrade pip
21+
RUN pip install --no-cache-dir --upgrade setuptools
22+
RUN pip install --no-cache-dir j2cli
23+
24+
# This file was generated by running CPAN once in "manual" not "local::lib" mode
25+
ADD MyConfig.pm /root/.cpan/CPAN/MyConfig.pm
26+
RUN sudo cpan -i CGI::Untaint
27+
28+
# Get DocDB software and install it
29+
RUN git clone https://github.com/ericvaandering/DocDB.git
30+
RUN mkdir -p /var/www/cgi-bin/DocDB && cp DocDB/DocDB/cgi/* /var/www/cgi-bin/DocDB
31+
RUN mkdir -p /var/www/html/DocDB/Static/ && cp -R /DocDB/DocDB/html/css/ /DocDB/DocDB/html/js/ /DocDB/DocDB/html/img/ /var/www/html/DocDB/Static/
32+
33+
ADD docker-entrypoint.sh /
34+
ADD dot-jobber.yaml /root/.jobber
35+
ENTRYPOINT ["/docker-entrypoint.sh"]

docker/MyConfig.pm

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
$CPAN::Config = {
2+
'applypatch' => q[],
3+
'auto_commit' => q[0],
4+
'build_cache' => q[100],
5+
'build_dir' => q[/root/.cpan/build],
6+
'build_dir_reuse' => q[0],
7+
'build_requires_install_policy' => q[yes],
8+
'bzip2' => q[],
9+
'cache_metadata' => q[1],
10+
'check_sigs' => q[0],
11+
'colorize_output' => q[0],
12+
'commandnumber_in_prompt' => q[1],
13+
'connect_to_internet_ok' => q[1],
14+
'cpan_home' => q[/root/.cpan],
15+
'curl' => q[/usr/bin/curl],
16+
'ftp_passive' => q[1],
17+
'ftp_proxy' => q[],
18+
'getcwd' => q[cwd],
19+
'gpg' => q[/usr/bin/gpg],
20+
'gzip' => q[/usr/bin/gzip],
21+
'halt_on_failure' => q[0],
22+
'histfile' => q[/root/.cpan/histfile],
23+
'histsize' => q[100],
24+
'http_proxy' => q[],
25+
'inactivity_timeout' => q[0],
26+
'index_expire' => q[1],
27+
'inhibit_startup_message' => q[0],
28+
'keep_source_where' => q[/root/.cpan/sources],
29+
'load_module_verbosity' => q[none],
30+
'make' => q[/usr/bin/make],
31+
'make_arg' => q[],
32+
'make_install_arg' => q[],
33+
'make_install_make_command' => q[/usr/bin/make],
34+
'makepl_arg' => q[],
35+
'mbuild_arg' => q[],
36+
'mbuild_install_arg' => q[],
37+
'mbuild_install_build_command' => q[./Build],
38+
'mbuildpl_arg' => q[],
39+
'no_proxy' => q[],
40+
'pager' => q[/usr/bin/less],
41+
'patch' => q[],
42+
'perl5lib_verbosity' => q[none],
43+
'prefer_external_tar' => q[1],
44+
'prefer_installer' => q[MB],
45+
'prefs_dir' => q[/root/.cpan/prefs],
46+
'prerequisites_policy' => q[follow],
47+
'scan_cache' => q[atstart],
48+
'shell' => undef,
49+
'show_unparsable_versions' => q[0],
50+
'show_upload_date' => q[0],
51+
'show_zero_versions' => q[0],
52+
'tar' => q[/usr/bin/tar],
53+
'tar_verbosity' => q[none],
54+
'term_is_latin' => q[1],
55+
'term_ornaments' => q[1],
56+
'test_report' => q[0],
57+
'trust_test_report_history' => q[0],
58+
'unzip' => q[],
59+
'urllist' => [q[http://ftp.halifax.rwth-aachen.de/cpan/], q[http://mirror.koddos.net/CPAN/], q[http://tux.rainside.sk/CPAN/]],
60+
'use_sqlite' => q[0],
61+
'version_timeout' => q[15],
62+
'wget' => q[],
63+
'yaml_load_code' => q[0],
64+
'yaml_module' => q[YAML],
65+
};
66+
1;
67+
__END__

docker/docker-entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/bash
2+
3+
cp /etc/grid-security/tls.crt /etc/pki/tls/certs/localhost.crt
4+
cp /etc/grid-security/tls.key /etc/pki/tls/private/localhost.key
5+
6+
echo "Starting jobber"
7+
/usr/local/libexec/jobbermaster &
8+
9+
echo "Starting sendmail"
10+
sendmail -bd
11+
12+
echo "Starting apache"
13+
httpd -D FOREGROUND

docker/dot-jobber.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
## This is your jobfile: use it to tell Jobber what jobs you want it to
2+
## run on your behalf. For details of what you can specify here,
3+
## please see https://dshearer.github.io/jobber/doc/.
4+
##
5+
## It consists of two sections: "prefs" and "jobs". In "prefs" you can
6+
## set various general settings. In "jobs", you define your jobs.
7+
8+
version: 1.4
9+
10+
prefs:
11+
## You can have the Jobber daemon keep a log of various activities
12+
## with the "logPath" setting; the log will be written to the given
13+
## path (if the path is relative, it will be interpreted relative to
14+
## your home directory). Your user account must be able to write to
15+
## the given path. NOTE: This is NOT where logs about job runs
16+
## are stored --- for that, see the "runLog" setting below. WARNING:
17+
## Jobber will NOT rotate this file.
18+
#logPath: jobber-log
19+
20+
## You can specify how info about past runs is stored. For
21+
## "type: memory" (the default), they are stored in memory and
22+
## are lost when the Jobber service stops.
23+
#runLog:
24+
# type: memory
25+
# maxLen: 100 # the max number of entries to remember
26+
27+
## For "type: file", past run logs are stored on disk. The log file is
28+
## rotated when it reaches a size of 'maxFileLen' MB. Up to
29+
## 'maxHistories' historical run logs (that is, not including the
30+
## current one) are kept.
31+
#runLog:
32+
# type: file
33+
# path: /tmp/claudius
34+
# maxFileLen: 50m # in MB
35+
# maxHistories: 5
36+
37+
resultSinks:
38+
#- &programSink
39+
# type: program
40+
# path: /home/handleError.sh
41+
42+
#- &systemEmailSink
43+
# type: system-email
44+
45+
#- &filesystemSink
46+
# type: filesystem
47+
# path: /path/to/dir
48+
# data: [stdout, stderr]
49+
# maxAgeDays: 10
50+
51+
jobs:
52+
## This section must contain a YAML sequence of maps like the following:
53+
#DailyBackup:
54+
# cmd: backup daily # shell command to execute
55+
# time: '* * * * * *' # SEC MIN HOUR MONTH_DAY MONTH WEEK_DAY.
56+
# onError: Continue # what to do when the job has an error: Stop, Backoff, or Continue
57+
# notifyOnError: [*programSink] # what to do with result when job has an error
58+
# notifyOnFailure: [*systemEmailSink, *programSink] # what to do with result when the job stops due to errors
59+
# notifyOnSuccess: [*filesystemSink] # what to do with result when the job succeeds
60+
Daily:
61+
cmd: cd /DocDB/DocDB/scripts; ./DocDBDaily.csh > /dev/null
62+
time: R 0 * * * *
63+
onError: Continue
64+
Weekly:
65+
cmd: cd /DocDB/DocDB/scripts; ./DocDBWeekly.csh > /dev/null
66+
time: R 0 * * * 0
67+
onError: Continue

0 commit comments

Comments
 (0)