summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-09-13 11:08:09 +0200
committerSimon Rettberg2019-09-13 11:08:09 +0200
commit24964f2e9af2a12475d6a95d34970456ad9a722b (patch)
treec0d676fcd99c3957a1008f09e0bd8814f91ae809
parent[CompileIPxeNew] 'nice' make, use all cores (-jN) (diff)
downloadtmlite-bwlp-24964f2e9af2a12475d6a95d34970456ad9a722b.tar.gz
tmlite-bwlp-24964f2e9af2a12475d6a95d34970456ad9a722b.tar.xz
tmlite-bwlp-24964f2e9af2a12475d6a95d34970456ad9a722b.zip
[SshdConfigGenerator] Unique filename for pubkey
This will allow for simple combination of multiple ssh config modules.
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/SshdConfigGenerator.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/SshdConfigGenerator.java b/src/main/java/org/openslx/taskmanager/tasks/SshdConfigGenerator.java
index 826c09d..fff70ca 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/SshdConfigGenerator.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/SshdConfigGenerator.java
@@ -62,8 +62,10 @@ public class SshdConfigGenerator extends AbstractTask
return false;
}
boolean ok = Archive.tarCreateFileFromString( outArchive, "/etc/ssh/sshd_config", template, 0644 );
- if ( publicKey != null && !publicKey.isEmpty() )
- ok |= Archive.tarCreateFileFromString( outArchive, "/root/.ssh/authorized_keys.d/sshd_conf_mod.pub", publicKey, 0600 );
+ if ( publicKey != null && !publicKey.isEmpty() ) {
+ String name = "sshd_conf_mod-" + publicKey.hashCode() + "-" + System.currentTimeMillis() + ".pub";
+ ok |= Archive.tarCreateFileFromString( outArchive, "/root/.ssh/authorized_keys.d/" + name, publicKey, 0600 );
+ }
ok |= Archive.tarCreateSymlink( outArchive, "../sshd.service", "/etc/systemd/system/network.target.wants/sshd.service" );
if ( !ok ) {
status.error = "Could not create module archive contents";