Skip to content

Commit 092ca36

Browse files
committed
Bumped wildfly-openssl for jdk21 and up to 2.3.alpha3
1 parent 8126c85 commit 092ca36

3 files changed

Lines changed: 151 additions & 94 deletions

File tree

jni/wildfly-openssl.bash

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
set -exo pipefail
3+
4+
if [ -z "$VERSION" ]; then
5+
echo "This is shared runner for newer wildfly openssl. VERSION must be set"
6+
exit 1
7+
fi
8+
9+
if [ -z "$NATIVES_VERSION" ]; then
10+
echo "This is shared runner for newer wildfly openssl. NATIVES_VERSION must be set"
11+
exit 1
12+
fi
13+
14+
15+
MVOPTS="--batch-mode"
16+
if [ "x$EX_MVN" == "x" ] ; then
17+
EX_MVN=mvn
18+
fi
19+
20+
DISABLE_testNoExplicitEnabledProtocols="true"
21+
DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange="true"
22+
DISABLE_testCipherSuiteConverter="true"
23+
DISABLE_testAvailableProtocolsWithTLS13CipherSuites="true"
24+
25+
function addIgnoreImport() {
26+
if ! grep -e "import org.junit.Ignore" "${1}" ; then #do not create duplicated imports
27+
sed "s/import org.junit.Test;/import org.junit.Test;import org.junit.Ignore;/" -i "${1}"
28+
fi
29+
}
30+
31+
ignoredTests=0
32+
function ignoreMethod() {
33+
local file=$(find -type f | grep "${2}.java$")
34+
grep -e "${1}[(]" "${file}" #check
35+
# do not inject ignore import if nothing will be sed
36+
addIgnoreImport "${file}"
37+
sed "s/${1}[(]/@Ignore ${1}(/g" -i "${file}"
38+
grep -e "@Ignore ${1}[(]" "${file}" #check
39+
let ignoredTests=$ignoredTests+1
40+
}
41+
42+
43+
# for generating patches
44+
#GIT=git
45+
GIT=echo
46+
47+
rm -rf wildfly-openssl
48+
mkdir wildfly-openssl
49+
pushd wildfly-openssl
50+
wget https://github.com/wildfly-security/wildfly-openssl-natives/archive/refs/tags/${NATIVES_VERSION}.tar.gz
51+
tar -xf ${NATIVES_VERSION}.tar.gz
52+
pushd wildfly-openssl-natives-${NATIVES_VERSION}
53+
$EX_MVN $MVOPTS clean install
54+
popd
55+
wget https://github.com/wildfly-security/wildfly-openssl/archive/refs/tags/${VERSION}.tar.gz
56+
tar -xf ${VERSION}.tar.gz
57+
# generally the testsuite is poorly designed. see SSLTestUtils.java
58+
# it reuses still same port, and do not release it in finally clausule,
59+
# so although it uses setReuseAddress, any first fail will kill all subsequent tests
60+
# as the port seems to survive junit's vm
61+
pushd wildfly-openssl-${VERSION}
62+
$GIT init
63+
$GIT add *
64+
$GIT commit . -m "initial commit"
65+
if [ "$DISABLE_testNoExplicitEnabledProtocols" = "true" ] ; then
66+
# this test fails with different crypto policies
67+
ignoreMethod "public void testNoExplicitEnabledProtocols" "BasicOpenSSLEngineTest"
68+
fi
69+
if [ "$DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" = "true" ] ; then
70+
# tls v 1.0 is being removed
71+
ignoreMethod "public void testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" "BasicOpenSSLEngineLegacyProtocolsTest"
72+
fi
73+
if [ "$DISABLE_testCipherSuiteConverter" = "true" ] ; then
74+
# this test fails with different crypto policies and there is no JNI at all. However to find wy it fials is interesting TODO.
75+
ignoreMethod "public void testCipherSuiteConverter" "SslCiphersTest"
76+
fi
77+
if [ "$DISABLE_testAvailableProtocolsWithTLS13CipherSuites" = "true" ] ; then
78+
# tls 1.3
79+
ignoreMethod "public void testAvailableProtocolsWithTLS13CipherSuites" "SslCiphersTest"
80+
fi
81+
if [ $ignoredTests -gt 0 ] ; then
82+
$GIT commit . -m "disbaled $ignoredTests tests"
83+
else
84+
echo "No test ignored"
85+
fi
86+
# it is better to set the libssl and libcrypto on our own
87+
# the wildfly-openssl search is just tragic, and the excception throwns out of it are very missleading
88+
# eg "not found ssl library" may be thrown from findCryptoLibray (where findSSL have passed fine)
89+
libssl=$( ls $(find /usr/lib /usr/lib64 -type l | grep libssl | grep -v -e .hmac -e .pc ) | head -n 1) ;
90+
libcrypt=$( ls $(find /usr/lib /usr/lib64 -type l | grep libcrypto | grep -v -e .hmac -e .pc ) | head -n 1) ;
91+
92+
allEnabledSecurity=`mktemp`
93+
echo 'jdk.tls.disabledAlgorithms='> "$allEnabledSecurity"
94+
useAllEnabledSecurity="-Djava.security.properties=$allEnabledSecurity"
95+
96+
#if problems with not freed port persists, run in loop of 2-3 mvn test, and return nonzero only if all fails
97+
if [ "x$OTOOL_OS_NAME" = "xel" -a "x$OTOOL_OS_VERSION" = "x7" ] ; then
98+
scl enable rh-maven36 -- mvn $MVOPTS $clean install $useAllEnabledSecurity -Dorg.wildfly.openssl.path.ssl=$libssl -Dorg.wildfly.openssl.path.crypto=$libcrypt
99+
else
100+
$EX_MVN $MVOPTS clean install $useAllEnabledSecurity -Dorg.wildfly.openssl.path.ssl=$libssl -Dorg.wildfly.openssl.path.crypto=$libcrypt
101+
fi
102+
if which update-crypto-policies 2>/dev/null 1>/dev/null ; then
103+
update-crypto-policies --show
104+
fi
105+
popd
106+
popd

jni/wildfly-openssl.sh

Lines changed: 14 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,26 @@
11
#!/bin/bash
2+
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
3+
while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
5+
SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")"
6+
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
7+
[[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE"
8+
done
9+
readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
10+
211
set -exo pipefail
312

4-
if [ "0$JDK_MAJOR" -eq 8 ]; then
5-
echo "!skipped! older wildfly needed for jdk8"
13+
if [ "0$JDK_MAJOR" -lt 21 ]; then
14+
echo "!skipped! older wildfly needed for jdk21 and up"
615
exit
716
fi
817
if [ "x$OS_NAME" == "xrhel" -a "0$OS_VERSION_MAJOR" -le "7" ]; then
918
echo "!skipped! rhel7 and older are to old "
1019
exit
1120
fi
1221

13-
MVOPTS="--batch-mode"
14-
if [ "x$EX_MVN" == "x" ] ; then
15-
EX_MVN=mvn
16-
fi
17-
18-
DISABLE_testNoExplicitEnabledProtocols="true"
19-
DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange="true"
20-
DISABLE_testCipherSuiteConverter="true"
21-
DISABLE_testAvailableProtocolsWithTLS13CipherSuites="true"
22-
23-
function addIgnoreImport() {
24-
if ! grep -e "import org.junit.Ignore" "${1}" ; then #do not create duplicated imports
25-
sed "s/import org.junit.Test;/import org.junit.Test;import org.junit.Ignore;/" -i "${1}"
26-
fi
27-
}
28-
29-
ignoredTests=0
30-
function ignoreMethod() {
31-
local file=$(find -type f | grep "${2}.java$")
32-
grep -e "${1}[(]" "${file}" #check
33-
# do not inject ignore import if nothing will be sed
34-
addIgnoreImport "${file}"
35-
sed "s/${1}[(]/@Ignore ${1}(/g" -i "${file}"
36-
grep -e "@Ignore ${1}[(]" "${file}" #check
37-
let ignoredTests=$ignoredTests+1
38-
}
39-
40-
41-
# for generating patches
42-
#GIT=git
43-
GIT=echo
44-
45-
NATIVES_VERSION=2.2.2.Final
46-
VERSION=2.2.5.Final
47-
rm -rf wildfly-openssl
48-
mkdir wildfly-openssl
49-
pushd wildfly-openssl
50-
wget https://github.com/wildfly-security/wildfly-openssl-natives/archive/refs/tags/${NATIVES_VERSION}.tar.gz
51-
tar -xf ${NATIVES_VERSION}.tar.gz
52-
pushd wildfly-openssl-natives-${NATIVES_VERSION}
53-
$EX_MVN $MVOPTS clean install
54-
popd
55-
wget https://github.com/wildfly-security/wildfly-openssl/archive/refs/tags/${VERSION}.tar.gz
56-
tar -xf ${VERSION}.tar.gz
57-
# generally the testsuite is poorly designed. see SSLTestUtils.java
58-
# it reuses still same port, and do not release it in finally clausule,
59-
# so although it uses setReuseAddress, any first fail will kill all subsequent tests
60-
# as the port seems to survive junit's vm
61-
pushd wildfly-openssl-${VERSION}
62-
$GIT init
63-
$GIT add *
64-
$GIT commit . -m "initial commit"
65-
if [ "$DISABLE_testNoExplicitEnabledProtocols" = "true" ] ; then
66-
# this test fails with different crypto policies
67-
ignoreMethod "public void testNoExplicitEnabledProtocols" "BasicOpenSSLEngineTest"
68-
fi
69-
if [ "$DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" = "true" ] ; then
70-
# tls v 1.0 is being removed
71-
ignoreMethod "public void testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" "BasicOpenSSLEngineLegacyProtocolsTest"
72-
fi
73-
if [ "$DISABLE_testCipherSuiteConverter" = "true" ] ; then
74-
# this test fails with different crypto policies and there is no JNI at all. However to find wy it fials is interesting TODO.
75-
ignoreMethod "public void testCipherSuiteConverter" "SslCiphersTest"
76-
fi
77-
if [ "$DISABLE_testAvailableProtocolsWithTLS13CipherSuites" = "true" ] ; then
78-
# tls 1.3
79-
ignoreMethod "public void testAvailableProtocolsWithTLS13CipherSuites" "SslCiphersTest"
80-
fi
81-
if [ $ignoredTests -gt 0 ] ; then
82-
$GIT commit . -m "disbaled $ignoredTests tests"
83-
else
84-
echo "No test ignored"
85-
fi
86-
# it is better to set the libssl and libcrypto on our own
87-
# the wildfly-openssl search is just tragic, and the excception throwns out of it are very missleading
88-
# eg "not found ssl library" may be thrown from findCryptoLibray (where findSSL have passed fine)
89-
libssl=$( ls $(find /usr/lib /usr/lib64 -type l | grep libssl | grep -v -e .hmac -e .pc ) | head -n 1) ;
90-
libcrypt=$( ls $(find /usr/lib /usr/lib64 -type l | grep libcrypto | grep -v -e .hmac -e .pc ) | head -n 1) ;
9122

92-
allEnabledSecurity=`mktemp`
93-
echo 'jdk.tls.disabledAlgorithms='> "$allEnabledSecurity"
94-
useAllEnabledSecurity="-Djava.security.properties=$allEnabledSecurity"
23+
export NATIVES_VERSION=2.3.0.Alpha3
24+
export VERSION=2.3.0.Alpha2
25+
bash "$SCRIPT_DIR/wildfly-openssl.bash"
9526

96-
#if problems with not freed port persists, run in loop of 2-3 mvn test, and return nonzero only if all fails
97-
if [ "x$OTOOL_OS_NAME" = "xel" -a "x$OTOOL_OS_VERSION" = "x7" ] ; then
98-
scl enable rh-maven36 -- mvn $MVOPTS $clean install $useAllEnabledSecurity -Dorg.wildfly.openssl.path.ssl=$libssl -Dorg.wildfly.openssl.path.crypto=$libcrypt
99-
else
100-
$EX_MVN $MVOPTS clean install $useAllEnabledSecurity -Dorg.wildfly.openssl.path.ssl=$libssl -Dorg.wildfly.openssl.path.crypto=$libcrypt
101-
fi
102-
if which update-crypto-policies 2>/dev/null 1>/dev/null ; then
103-
update-crypto-policies --show
104-
fi
105-
popd
106-
popd

jni/wildfly11-17-openssl.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
3+
while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
5+
SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")"
6+
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
7+
[[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE"
8+
done
9+
readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
10+
11+
set -exo pipefail
12+
13+
if [ "0$JDK_MAJOR" -lt 11 ]; then
14+
echo "!skipped! older wildfly needed for jdk8"
15+
exit
16+
fi
17+
if [ "0$JDK_MAJOR" -ge 21 ]; then
18+
echo "!skipped! newer wildfly needed for jdk21"
19+
exit
20+
fi
21+
if [ "x$OS_NAME" == "xrhel" -a "0$OS_VERSION_MAJOR" -le "7" ]; then
22+
echo "!skipped! rhel7 and older are to old "
23+
exit
24+
fi
25+
26+
27+
export NATIVES_VERSION=2.2.2.Final
28+
export VERSION=2.2.5.Final
29+
bash "$SCRIPT_DIR/wildfly-openssl.bash"
30+
31+

0 commit comments

Comments
 (0)