diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/openslx/taskmanager/tasks/LighttpdHttps.java | 16 |
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; |