Skip to content

Commit dfb067e

Browse files
committed
Fix: Red Hat Certificate SystemRHCS-5663
Dogtag on f43 / tomcat 10 - pki - Get current rest easy 3.x working under the CA - phase 2. JSS modifications needed to make dogtag work under tomcat10.
1 parent 26cced2 commit dfb067e

12 files changed

Lines changed: 1127 additions & 21 deletions

File tree

jss.spec

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,14 @@ This only works with gcj. Other JREs require that JCE providers be signed.
149149
Summary: Java Security Services (JSS) Connector for Tomcat
150150

151151
# Tomcat
152-
BuildRequires: mvn(org.apache.tomcat:tomcat-catalina) >= 9.0.62
153-
BuildRequires: mvn(org.apache.tomcat:tomcat-coyote) >= 9.0.62
154-
BuildRequires: mvn(org.apache.tomcat:tomcat-juli) >= 9.0.62
155-
%if 0%{?rhel} && 0%{?rhel} >= 10
156-
BuildRequires: tomcat9-lib
157-
%endif
152+
BuildRequires: mvn(org.apache.tomcat:tomcat-catalina) >= 10.1.24
153+
BuildRequires: mvn(org.apache.tomcat:tomcat-coyote) >= 10.1.24
154+
BuildRequires: mvn(org.apache.tomcat:tomcat-juli) >= 10.1.24
158155

159156
Requires: %{product_id} = %{version}-%{release}
160-
Requires: mvn(org.apache.tomcat:tomcat-catalina) >= 9.0.62
161-
Requires: mvn(org.apache.tomcat:tomcat-coyote) >= 9.0.62
162-
Requires: mvn(org.apache.tomcat:tomcat-juli) >= 9.0.62
163-
%if 0%{?rhel} && 0%{?rhel} >= 10
164-
Requires: tomcat9 >= 1:9.0.62
165-
%endif
157+
Requires: mvn(org.apache.tomcat:tomcat-catalina) >= 10.1.24
158+
Requires: mvn(org.apache.tomcat:tomcat-coyote) >= 10.1.24
159+
Requires: mvn(org.apache.tomcat:tomcat-juli) >= 10.1.24
166160

167161
# Tomcat JSS has been replaced with JSS Connector for Tomcat.
168162
# This will remove installed Tomcat JSS packages.
@@ -250,11 +244,11 @@ This package provides test suite for JSS.
250244

251245
# specify Maven artifact locations
252246
%mvn_file org.dogtagpki.jss:jss-tomcat jss/jss-tomcat
253-
%mvn_file org.dogtagpki.jss:jss-tomcat-9.0 jss/jss-tomcat-9.0
247+
%mvn_file org.dogtagpki.jss:jss-tomcat-10.1 jss/jss-tomcat-10.1
254248

255249
# specify Maven artifact packages
256250
%mvn_package org.dogtagpki.jss:jss-tomcat jss-tomcat
257-
%mvn_package org.dogtagpki.jss:jss-tomcat-9.0 jss-tomcat
251+
%mvn_package org.dogtagpki.jss:jss-tomcat-10.1 jss-tomcat
258252

259253
################################################################################
260254
%build

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
<module>symkey</module>
2525
<module>examples</module>
2626
<module>tomcat</module>
27-
<module>tomcat-9.0</module>
27+
<!-- <module>tomcat-9.0</module> -->
28+
<module>tomcat-10.1</module>
2829
</modules>
2930

3031
<build>

tomcat-10.1/pom.xml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>org.dogtagpki.jss</groupId>
10+
<artifactId>jss-parent</artifactId>
11+
<version>5.7.0-SNAPSHOT</version>
12+
</parent>
13+
14+
<artifactId>jss-tomcat-10.1</artifactId>
15+
<packaging>jar</packaging>
16+
17+
<dependencies>
18+
19+
<dependency>
20+
<groupId>org.apache.tomcat</groupId>
21+
<artifactId>tomcat-catalina</artifactId>
22+
<version>10.1.33</version>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>org.apache.tomcat</groupId>
27+
<artifactId>tomcat-coyote</artifactId>
28+
<version>10.1.33</version>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.apache.tomcat</groupId>
33+
<artifactId>tomcat-juli</artifactId>
34+
<version>10.1.33</version>
35+
</dependency>
36+
37+
<dependency>
38+
<groupId>${project.groupId}</groupId>
39+
<artifactId>jss-base</artifactId>
40+
<version>${project.version}</version>
41+
</dependency>
42+
43+
<dependency>
44+
<groupId>${project.groupId}</groupId>
45+
<artifactId>jss-tomcat</artifactId>
46+
<version>${project.version}</version>
47+
</dependency>
48+
49+
</dependencies>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-compiler-plugin</artifactId>
56+
<version>3.8.1</version>
57+
<configuration>
58+
<release>17</release>
59+
</configuration>
60+
</plugin>
61+
</plugins>
62+
<finalName>jss-tomcat-10.1</finalName>
63+
</build>
64+
65+
</project>
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/* BEGIN COPYRIGHT BLOCK
2+
* This library is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 2.1 of the License, or (at your option) any later version.
6+
*
7+
* This library is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public
13+
* License along with this library; if not, write to the Free Software
14+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15+
*
16+
* Copyright (C) 2017 Red Hat, Inc.
17+
* All rights reserved.
18+
* END COPYRIGHT BLOCK */
19+
package org.dogtagpki.jss.tomcat;
20+
21+
import java.io.IOException;
22+
import java.nio.file.Files;
23+
import java.nio.file.Path;
24+
import java.nio.file.Paths;
25+
26+
import org.apache.coyote.http11.AbstractHttp11JsseProtocol;
27+
import org.apache.juli.logging.Log;
28+
import org.apache.juli.logging.LogFactory;
29+
import org.apache.tomcat.util.net.NioChannel;
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
32+
33+
public class Http11NioProtocol extends AbstractHttp11JsseProtocol<NioChannel> {
34+
35+
public static Logger logger = LoggerFactory.getLogger(Http11NioProtocol.class);
36+
private static final Log log = LogFactory.getLog(Http11NioProtocol.class);
37+
38+
TomcatJSS tomcatjss = TomcatJSS.getInstance();
39+
40+
public Http11NioProtocol() {
41+
super(new JSSNioEndpoint());
42+
}
43+
44+
public String getCertdbDir() {
45+
return tomcatjss.getCertdbDir();
46+
}
47+
48+
public void setCertdbDir(String certdbDir) {
49+
tomcatjss.setCertdbDir(certdbDir);
50+
}
51+
52+
public String getPasswordClass() {
53+
return tomcatjss.getPasswordClass();
54+
}
55+
56+
public void setPasswordClass(String passwordClass) {
57+
tomcatjss.setPasswordClass(passwordClass);
58+
}
59+
60+
public String getPasswordFile() {
61+
return tomcatjss.getPasswordFile();
62+
}
63+
64+
public void setPasswordFile(String passwordFile) {
65+
tomcatjss.setPasswordFile(passwordFile);
66+
}
67+
68+
public String getServerCertNickFile() {
69+
return tomcatjss.getServerCertNickFile();
70+
}
71+
72+
public void setServerCertNickFile(String serverCertNickFile) {
73+
tomcatjss.setServerCertNickFile(serverCertNickFile);
74+
}
75+
76+
public boolean getEnableOCSP() {
77+
return tomcatjss.getEnableRevocationCheck();
78+
}
79+
80+
public void setEnableOCSP(boolean enableOCSP) {
81+
tomcatjss.setEnableRevocationCheck(enableOCSP);
82+
}
83+
84+
public boolean getEnableRevocationCheck() {
85+
return tomcatjss.getEnableRevocationCheck();
86+
}
87+
88+
public void setEnableRevocationCheck(boolean enableRevocationCheck) {
89+
tomcatjss.setEnableRevocationCheck(enableRevocationCheck);
90+
}
91+
92+
public String getOcspResponderURL() {
93+
return tomcatjss.getOcspResponderURL();
94+
}
95+
96+
public void setOcspResponderURL(String ocspResponderURL) {
97+
tomcatjss.setOcspResponderURL(ocspResponderURL);
98+
}
99+
100+
public String getOcspResponderCertNickname() {
101+
return tomcatjss.getOcspResponderCertNickname();
102+
}
103+
104+
public void setOcspResponderCertNickname(String ocspResponderCertNickname) {
105+
tomcatjss.setOcspResponderCertNickname(ocspResponderCertNickname);
106+
}
107+
108+
public int getOcspCacheSize() {
109+
return tomcatjss.getOcspCacheSize();
110+
}
111+
112+
public void setOcspCacheSize(int ocspCacheSize) {
113+
tomcatjss.setOcspCacheSize(ocspCacheSize);
114+
}
115+
116+
public int getOcspMinCacheEntryDuration() {
117+
return tomcatjss.getOcspMinCacheEntryDuration();
118+
}
119+
120+
public void setOcspMinCacheEntryDuration(int ocspMinCacheEntryDuration) {
121+
tomcatjss.setOcspMinCacheEntryDuration(ocspMinCacheEntryDuration);
122+
}
123+
124+
public int getOcspMaxCacheEntryDuration() {
125+
return tomcatjss.getOcspMaxCacheEntryDuration();
126+
}
127+
128+
public void setOcspMaxCacheEntryDuration(int ocspMaxCacheEntryDuration) {
129+
tomcatjss.setOcspMaxCacheEntryDuration(ocspMaxCacheEntryDuration);
130+
}
131+
132+
public int getOcspTimeout() {
133+
return tomcatjss.getOcspTimeout();
134+
}
135+
136+
public void setOcspTimeout(int ocspTimeout) {
137+
tomcatjss.setOcspTimeout(ocspTimeout);
138+
}
139+
140+
/* public void setKeystorePassFile(String keystorePassFile) {
141+
try {
142+
Path path = Paths.get(keystorePassFile);
143+
String password = new String(Files.readAllBytes(path)).trim();
144+
setKeystorePass(password);
145+
146+
} catch (IOException e) {
147+
throw new RuntimeException(e);
148+
}
149+
}
150+
151+
public void setTruststorePassFile(String truststorePassFile) {
152+
try {
153+
Path path = Paths.get(truststorePassFile);
154+
String password = new String(Files.readAllBytes(path)).trim();
155+
setTruststorePass(password);
156+
157+
} catch (IOException e) {
158+
throw new RuntimeException(e);
159+
}
160+
}
161+
*/
162+
@Override
163+
protected Log getLog() {
164+
return log;
165+
}
166+
167+
@Override
168+
protected String getNamePrefix() {
169+
if (isSSLEnabled()) {
170+
return "https-" + getSslImplementationShortName()+ "-jss-nio";
171+
}
172+
return "http-jss-nio";
173+
}
174+
175+
// These methods are temporarly present to replicate the default behaviour provided by tomcat
176+
public void setSelectorTimeout(long timeout) {
177+
((JSSNioEndpoint)getEndpoint()).setSelectorTimeout(timeout);
178+
}
179+
180+
public long getSelectorTimeout() {
181+
return ((JSSNioEndpoint)getEndpoint()).getSelectorTimeout();
182+
}
183+
184+
public void setPollerThreadPriority(int threadPriority) {
185+
((JSSNioEndpoint)getEndpoint()).setPollerThreadPriority(threadPriority);
186+
}
187+
188+
public int getPollerThreadPriority() {
189+
return ((JSSNioEndpoint)getEndpoint()).getPollerThreadPriority();
190+
}
191+
}

0 commit comments

Comments
 (0)