Skip to content

Commit

Permalink
ConSol#233 ConSol#255 add JCE policy check to install routine - OpenJ…
Browse files Browse the repository at this point in the history
…DK of centos & ubuntu supports JCE
  • Loading branch information
Tobias Schneck committed Jan 13, 2017
1 parent 1745179 commit 6783f75
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 11 deletions.
13 changes: 2 additions & 11 deletions docker/Dockerfile.sakuli.ubuntu.xfce
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,12 @@ ADD ./sakuli-client/src/common/install/ $INST_SCRIPTS/
ADD ./sakuli-client/src/ubuntu/install/ $INST_SCRIPTS/
RUN find $INST_SCRIPTS -name '*.sh' -exec chmod a+x {} +

### Install ...
### Install needed packages
RUN $INST_SCRIPTS/example_apps.sh
RUN $INST_SCRIPTS/screenshot_tool.sh
RUN $INST_SCRIPTS/native_screen_control_libs.sh
RUN $INST_SCRIPTS/java_jre.sh

### TODO Install JAVA JCE policy (necessary for gearman encryption)
### JCE Download page: http://www.oracle.com/technetwork/java/javase/downloads/index.html
#RUN mkdir -p /tmp/java-jce \
# && cd /tmp/java-jce \
# && wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip \
# && unzip *.zip \
# && for i in $(find /usr/lib/jvm -name "security"); do /bin/cp -v -f UnlimitedJCEPolicyJDK8/*.jar $i; done \
# && rm -rf /tmp/java-jce

RUN $INST_SCRIPTS/java_jce_test/jce_test.sh

### Install Sakuli
ARG SAKULI_VERSION=1.1.0-SNAPSHOT-218_docker_usermod_openshift
Expand Down
2 changes: 2 additions & 0 deletions docker/sakuli-client/src/centos/install/java_jre.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
### every exit != 0 fails the script
set -e

echo "Install Java JRE 8"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Sakuli - Testing and Monitoring-Tool for Websites and common UIs.
*
* Copyright 2013 - 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;

public class KeyLengthDetector {
public static void main(String[] args) throws Exception {
int allowedKeyLength = 0;

try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}

if (allowedKeyLength <= 256) {
throw new Exception("Detect the allowed size of AES keys on the JVM is <= 256. So in that case the Gearman encryption feature can not be supported! To fix it JCE unlimted stregth files are needed.");
}
System.out.println("The allowed key length for AES is: " + allowedKeyLength);
}
}
Binary file not shown.
18 changes: 18 additions & 0 deletions docker/sakuli-client/src/common/install/java_jce_test/jce_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
### every exit != 0 fails the script
set -e

cd $(dirname `which $0`)
scriptdir=$(pwd)
echo "DIR: $scriptdir"

## check if installed Java JRE is supported by JCE
java -cp $scriptdir/classes KeyLengthDetector

### JCE Download page: http://www.oracle.com/technetwork/java/javase/downloads/index.html
#mkdir -p /tmp/java-jce \
# && cd /tmp/java-jce \
# && wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip \
# && unzip *.zip \
# && for i in $(find /usr/lib/jvm -name "security"); do /bin/cp -v -f UnlimitedJCEPolicyJDK8/*.jar $i; done \
# && rm -rf /tmp/java-jce
1 change: 1 addition & 0 deletions docker/sakuli-client/src/common/install/sakuli.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
### every exit != 0 fails the script
set -e

echo "Install Sakuli v$SAKULI_VERSION to '$SAKULI_ROOT'"
Expand Down
2 changes: 2 additions & 0 deletions docker/sakuli-client/src/ubuntu/install/java_jre.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
### every exit != 0 fails the script
set -e

echo "Install Java JRE 8"

Expand Down

0 comments on commit 6783f75

Please sign in to comment.