Skip to content

Commit 17bd0c1

Browse files
committed
Merge branch 'release/v0.3.1'
2 parents c7a8a05 + b64a4c2 commit 17bd0c1

30 files changed

Lines changed: 564 additions & 364 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ dist/
4242
nbdist/
4343
nbactions.xml
4444
.nb-gradle/
45+
/nbproject/
4546

4647

4748
### Eclipse ###

CHANGELOG

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# KeyServer Change Log
22

3+
v0.3.1
4+
--------------------------------------------------------------------------------
5+
Features:
6+
- Impoved Redis connection security.
7+
- Auto remove a Private Key from Redis database before a specific date.
8+
9+
Bug fixes:
10+
- SKI protocol draft-cairns-tls-session-key-interface-01 compliance.
11+
- Data base connection lost not detected.
12+
13+
314
v0.3.0
415
--------------------------------------------------------------------------------
516
Features:
@@ -11,7 +22,7 @@ Features:
1122
Bug fixes:
1223
- HTTPS certificate expiration date control.
1324

14-
25+
1526
v0.2.3
1627
--------------------------------------------------------------------------------
1728
Features:
@@ -20,8 +31,8 @@ Features:
2031
- Support more cipher suites on https server.
2132
- KeyServer Configuration more parametric.
2233
- Include KeyServer Private Key provider tool.
23-
24-
34+
35+
2536
v0.1.3
2637
--------------------------------------------------------------------------------
2738
Features:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Repository branch build status:
66
|:---:|:---:|
77
| [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=master)](https://travis-ci.org/mami-project/KeyServer) | [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=develop)](https://travis-ci.org/mami-project/KeyServer) |
88

9-
This software is a Key Server that implements the TLS Session Key Interface (SKI) defined in [draft-cairns-tls-session-key-interface-00](https://tools.ietf.org/html/draft-cairns-tls-session-key-interface-00 "Session Key Interface (SKI) for TLS and DTLS").
9+
This software is a Key Server that implements the TLS Session Key Interface (SKI) defined in [draft-cairns-tls-session-key-interface-01](https://tools.ietf.org/html/draft-cairns-tls-session-key-interface-01 "Session Key Interface (SKI) for TLS and DTLS").
1010

1111
The Heartbleed attack illustrated the security problems with storing private keys in the memory of the TLS server. The TLS Session Key Interface (SKI) defined the mentioned document makes it possible to store private keys in a highly trusted key server, physically separated from client facing servers. The TLS server is split into two distinct entities called
1212
Edge Server and Key Server that communicate over an encrypted and mutually authenticated channel using e.g. TLS. This software implements the Key Server entity.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- The Basics -->
55
<groupId>es.tid.keyserver</groupId>
66
<artifactId>KeyServer</artifactId>
7-
<version>v0.3.0</version>
7+
<version>v0.3.1</version>
88
<packaging>jar</packaging>
99
<prerequisites>
1010
<maven>3.0</maven>

src/main/java/es/tid/keyserver/config/ConfigController.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class ConfigController implements CheckObject{
3434
/**
3535
* Logging object.
3636
*/
37-
private static org.slf4j.Logger logger;
37+
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ConfigController.class);
3838
/**
3939
* Maven project data object.
4040
*/
@@ -55,7 +55,6 @@ public class ConfigController implements CheckObject{
5555
* @since v0.3.0
5656
*/
5757
public ConfigController(String mvnFileRoute, String ksFileRoute, String [] ksRequiredFields) {
58-
logger = LoggerFactory.getLogger(ConfigController.class);
5958
// Instantiation of configuration objects.
6059
mavenData = new Maven(mvnFileRoute);
6160
keyserverConfig = new ConfigFile(ksFileRoute, ksRequiredFields);
@@ -114,11 +113,11 @@ public InetAddress getServerAddress(){
114113
return InetAddress.getByName(address);
115114
} catch (UnknownHostException ex) {
116115
// Error level.
117-
logger.error("Unknown Host Exception with the server IP addres: {}", address);
116+
LOGGER.error("Unknown Host Exception with the server IP addres: {}", address);
118117
// Trace level.
119118
StringWriter errors = new StringWriter();
120119
ex.printStackTrace(new PrintWriter(errors));
121-
logger.trace(errors.toString());
120+
LOGGER.trace(errors.toString());
122121
return null;
123122
}
124123
}
@@ -135,7 +134,7 @@ public int getServerPort(){
135134
return Integer.parseInt(port);
136135
} else {
137136
// Error level.
138-
logger.error("Not valid HTTPS port specified for the KeyServer: {}", port);
137+
LOGGER.error("Not valid HTTPS port specified for the KeyServer: {}", port);
139138
return -1;
140139
}
141140
}
@@ -193,7 +192,7 @@ public int getServerBacklog(){
193192
return Integer.parseInt(backlog);
194193
} else {
195194
// Error level.
196-
logger.error("Not valid Backlog parammeter specified on KeyServer config file: {}", backlog);
195+
LOGGER.error("Not valid Backlog parammeter specified on KeyServer config file: {}", backlog);
197196
return -1;
198197
}
199198
}
@@ -281,11 +280,11 @@ public InetAddress getDbAddress(){
281280
return InetAddress.getByName(address);
282281
} catch (UnknownHostException ex) {
283282
// Error level.
284-
logger.error("Unnknown Host Exception with Redis Dtabase IP address: {}", address);
283+
LOGGER.error("Unnknown Host Exception with Redis Dtabase IP address: {}", address);
285284
// Trace level.
286285
StringWriter errors = new StringWriter();
287286
ex.printStackTrace(new PrintWriter(errors));
288-
logger.trace(errors.toString());
287+
LOGGER.trace(errors.toString());
289288
return null;
290289
}
291290
}
@@ -302,11 +301,28 @@ public int getDbPort(){
302301
return Integer.parseInt(port);
303302
} else {
304303
// Error level.
305-
logger.error("Not valid port specified for the Redis Database: {}", port);
304+
LOGGER.error("Not valid port specified for the Redis Database: {}", port);
306305
return -1;
307306
}
308307
}
309308

309+
/**
310+
* This method is used to get Redis Database password.
311+
* @return Integer with the Redis Database password. If the field is not present,
312+
* returns `null`.
313+
* @since v0.3.1
314+
*/
315+
public String getDbPassword(){
316+
String password = this.keyserverConfig.getDbPassword();
317+
if(password != null){
318+
return password;
319+
} else {
320+
// Error level.
321+
LOGGER.error("Not valid password specified for the Redis Database: {}", password);
322+
return null;
323+
}
324+
}
325+
310326
/**
311327
* This method is used to get the IP whitelist file name for KeyServer
312328
* access control.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* This package contains the code to administration and alerts configurations.
33
* @author <a href="mailto:jgm1986@hotmail.com">Javier Gusano Martinez</a>
4-
* @since TODO Set the since version value for this package
4+
* @since v0.3.1
55
*/
66
package es.tid.keyserver.config.admin;

src/main/java/es/tid/keyserver/config/keyserver/ConfigFile.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ConfigFile implements CheckObject{
3535
/**
3636
* Logging object.
3737
*/
38-
private static org.slf4j.Logger logger;
38+
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ConfigFile.class);
3939
/**
4040
* Property object with configuration parameters.
4141
*/
@@ -53,15 +53,14 @@ public class ConfigFile implements CheckObject{
5353
* @since v0.1.0
5454
*/
5555
public ConfigFile(String fileRoute, String [] requiredFields){
56-
logger = LoggerFactory.getLogger(ConfigFile.class);
5756
File propertiesFile = new File(fileRoute);
5857
String fileLocation;
5958
if((propertiesFile.exists() && propertiesFile.canRead())){
6059
fileLocation = fileRoute;
6160
} else {
62-
logger.warn("Can't access to the specified config file or "
61+
LOGGER.warn("Can't access to the specified config file or "
6362
+ "doesn't exists: {}", fileRoute);
64-
logger.info("New config file on default location...");
63+
LOGGER.info("New config file on default location...");
6564
fileLocation = "general.properties";
6665
if(!newDefaultProperties(fileLocation)){
6766
// If the default properties file can't be created correctly,
@@ -78,11 +77,11 @@ public ConfigFile(String fileRoute, String [] requiredFields){
7877
} catch (IOException ex) {
7978
initStatus = false;
8079
// Error level.
81-
logger.error("Can't load the KeyServer configuration file: {}", fileRoute);
80+
LOGGER.error("Can't load the KeyServer configuration file: {}", fileRoute);
8281
// Trace level.
8382
StringWriter errors = new StringWriter();
8483
ex.printStackTrace(new PrintWriter(errors));
85-
logger.trace(errors.toString());
84+
LOGGER.trace(errors.toString());
8685
}
8786
}
8887

@@ -257,6 +256,16 @@ public String getDbPort(){
257256
return this.getParameter("dbPort");
258257
}
259258

259+
/**
260+
* This method is used to get Redis Database password.
261+
* @return String with the Redis Database Password. If the field is not
262+
* present, returns 'null'.
263+
* @since v0.3.1
264+
*/
265+
public String getDbPassword(){
266+
return this.getParameter("dbPassword");
267+
}
268+
260269
/**
261270
* This method is used to get the IP whitelist file name for KeyServer
262271
* access control.
@@ -292,26 +301,27 @@ private boolean newDefaultProperties(String fileLocation) {
292301
defaultParameters.setProperty("serverKeyStore", "JKS");
293302
defaultParameters.setProperty("dbAddress","127.0.0.1");
294303
defaultParameters.setProperty("dbPort", "6379");
304+
defaultParameters.setProperty("dbPassword", "foobared"); // Default password for Redis config file.
295305
defaultParameters.setProperty("whiteList", "IP_whitelist.txt");
296306
// Save parameters on file
297307
defaultParameters.store(newConfigFile, null);
298308
// Close configuration file.
299309
newConfigFile.close();
300310
} catch (FileNotFoundException ex) {
301311
// Error level.
302-
logger.error("Can't create a new config file with default parameters. File not found.");
312+
LOGGER.error("Can't create a new config file with default parameters. File not found.");
303313
// Trace level.
304314
StringWriter errors = new StringWriter();
305315
ex.printStackTrace(new PrintWriter(errors));
306-
logger.trace(errors.toString());
316+
LOGGER.trace(errors.toString());
307317
return false;
308318
} catch (IOException ex) {
309319
// Error level.
310-
logger.error("Can't create a new config file with default parameters. IO exception.");
320+
LOGGER.error("Can't create a new config file with default parameters. IO exception.");
311321
// Trace level.
312322
StringWriter errors = new StringWriter();
313323
ex.printStackTrace(new PrintWriter(errors));
314-
logger.trace(errors.toString());
324+
LOGGER.trace(errors.toString());
315325
return false;
316326
}
317327
return true;
@@ -327,7 +337,7 @@ private boolean checkFieldsPresent(String [] fields){
327337
for (String field : fields) {
328338
if (!configFile.containsKey(field)) {
329339
// Error level.
330-
logger.error("A neccessary configuration field is not present. Please "
340+
LOGGER.error("A neccessary configuration field is not present. Please "
331341
+ "set this field : {} on KeyServer configuration file.", field);
332342
return false;
333343
}

src/main/java/es/tid/keyserver/config/maven/Maven.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Maven implements CheckObject{
3737
/**
3838
* Logging object.
3939
*/
40-
private static org.slf4j.Logger logger;
40+
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Maven.class);
4141
/**
4242
* Current object initialization flag
4343
*/
@@ -50,7 +50,6 @@ public class Maven implements CheckObject{
5050
* @since v0.3.0
5151
*/
5252
public Maven(String fileName){
53-
logger = LoggerFactory.getLogger(Maven.class);
5453
InputStream resourceAsStream = this.getClass().getResourceAsStream(fileName);
5554
prop = new Properties();
5655
try {
@@ -59,13 +58,13 @@ public Maven(String fileName){
5958
} catch (IOException ex) {
6059
initStatus = false;
6160
// Error level.
62-
logger.error("The current config file: " + fileName + " can't be loaded correctly.");
61+
LOGGER.error("The current config file: " + fileName + " can't be loaded correctly.");
6362
// Debug level.
6463
StringWriter errors = new StringWriter();
6564
ex.printStackTrace(new PrintWriter(errors));
66-
logger.trace(errors.toString());
65+
LOGGER.trace(errors.toString());
6766
}
68-
logger.debug("Maven config file: " + fileName + " correctly loaded.");
67+
LOGGER.debug("Maven config file: " + fileName + " correctly loaded.");
6968
initStatus = true;
7069
}
7170

0 commit comments

Comments
 (0)