Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to restrict which SSL/TLS protocols are permitted #1328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/distrib/data/defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,13 @@ server.certificateAlias = localhost
# RESTART REQUIRED
server.storePassword = gitblit

# SSL/TLS protocols to exclude
# Comma separated list of SSL/TLS protocols to exclude from HTTPS support
#
# SINCE 1.9.0
# RESTART REQUIRED
server.sslExcludeProtocols = SSLv3

# If serving over https (recommended) you might consider requiring clients to
# authenticate with ssl certificates. If enabled, only https clients with the
# a valid client certificate will be able to access Gitblit.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/gitblit/GitBlitServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,14 @@ public void log(String message) {
* HTTPS
*/
logger.info("Setting up HTTPS transport on port " + params.securePort);
String sslExcludeProtocolsStr = settings.getString(Keys.server.sslExcludeProtocols, "SSLv3");
String[] sslExcludeProtocols = null;
if (sslExcludeProtocolsStr.length() > 0) {
sslExcludeProtocols = sslExcludeProtocolsStr.split(",");
}
GitblitSslContextFactory factory = new GitblitSslContextFactory(params.alias,
serverKeyStore, serverTrustStore, params.storePassword, caRevocationList);
serverKeyStore, serverTrustStore, params.storePassword, caRevocationList,
sslExcludeProtocols);
if (params.requireClientCertificates) {
factory.setNeedClientAuth(true);
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/gitblit/GitblitSslContextFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class GitblitSslContextFactory extends SslContextFactory {
private final File caRevocationList;

public GitblitSslContextFactory(String certAlias, File keyStore, File clientTrustStore,
String storePassword, File caRevocationList) {
String storePassword, File caRevocationList, String[] excludeProtocols) {
super(keyStore.getAbsolutePath());

this.caRevocationList = caRevocationList;
Expand All @@ -54,7 +54,9 @@ public GitblitSslContextFactory(String certAlias, File keyStore, File clientTrus
setKeyStorePassword(storePassword);
setTrustStorePath(clientTrustStore.getAbsolutePath());
setTrustStorePassword(storePassword);
addExcludeProtocols("SSLv3");
if ((excludeProtocols != null) && (excludeProtocols.length > 0)) {
addExcludeProtocols(excludeProtocols);
}

logger.info(" keyStorePath = " + keyStore.getAbsolutePath());
logger.info(" trustStorePath = " + clientTrustStore.getAbsolutePath());
Expand Down