summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx
diff options
context:
space:
mode:
authorSimon Rettberg2014-11-18 19:26:40 +0100
committerSimon Rettberg2014-11-18 19:26:40 +0100
commitd4ccf048ac965360c4d8cda1541cc924eee72570 (patch)
tree7bf153a9cb9b67dda7ea42b4a5552f21ea8071bb /src/main/java/org/openslx
parentMany improvements and additions: (diff)
downloadtmlite-bwlp-d4ccf048ac965360c4d8cda1541cc924eee72570.tar.gz
tmlite-bwlp-d4ccf048ac965360c4d8cda1541cc924eee72570.tar.xz
tmlite-bwlp-d4ccf048ac965360c4d8cda1541cc924eee72570.zip
[LighttpdHttps] Allow importing a certificate chain
Diffstat (limited to 'src/main/java/org/openslx')
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java b/src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java
index 1b5e8e8..e3a06bf 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java
@@ -17,6 +17,8 @@ public class LighttpdHttps extends AbstractTask
private String importcert = null;
@Expose
private String importkey = null;
+ @Expose
+ private String importchain = null;
@Expose
private String proxyip = null;
@@ -53,12 +55,17 @@ public class LighttpdHttps extends AbstractTask
// Import supplied certificate and key. Test if they are valid first
File tmpKey = null;
File tmpCert = null;
+ File tmpChain = null;
try {
try {
tmpKey = File.createTempFile( "bwlp-", ".pem" );
- tmpCert = File.createTempFile( "bwlp-", ".pem" );
Util.writeStringToFile( tmpCert, this.importcert );
+ tmpCert = File.createTempFile( "bwlp-", ".pem" );
Util.writeStringToFile( tmpKey, this.importkey );
+ if ( this.importchain != null && !this.importchain.isEmpty() ) {
+ tmpChain = File.createTempFile( "bwlp-", ".pem" );
+ Util.writeStringToFile( tmpChain, this.importchain );
+ }
} catch ( Exception e ) {
status.error = "Could not create temporary files!";
return false;
@@ -69,7 +76,12 @@ public class LighttpdHttps extends AbstractTask
status.error = "Given key and certificate do not match, or have invalid format (exit code: " + ret + ")";
return false;
}
- ret = Exec.sync( "sudo", "-n", "-u", "root", "/opt/taskmanager/scripts/install-https", "--import", tmpKey.getAbsolutePath(), tmpCert.getAbsolutePath() );
+ if ( tmpChain != null ) {
+ ret = Exec.sync( "sudo", "-n", "-u", "root", "/opt/taskmanager/scripts/install-https", "--import", tmpKey.getAbsolutePath(), tmpCert.getAbsolutePath(),
+ tmpChain.getAbsolutePath() );
+ } else {
+ ret = Exec.sync( "sudo", "-n", "-u", "root", "/opt/taskmanager/scripts/install-https", "--import", tmpKey.getAbsolutePath(), tmpCert.getAbsolutePath() );
+ }
if ( ret != 0 ) {
status.error = "import exited with code " + ret;
return false;