diff options
author | Simon Rettberg | 2017-11-03 17:49:58 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-11-03 17:49:58 +0100 |
commit | 4aad3f3e894a061ee94f5386dd9256051491fa4a (patch) | |
tree | 030b40ac1c01fec0717cf0b16b173db33f43e38a /modules-available/rebootcontrol/hooks | |
parent | [inc/event] Don't try to start DozmodLauncher task - doesn't exist (diff) | |
download | slx-admin-4aad3f3e894a061ee94f5386dd9256051491fa4a.tar.gz slx-admin-4aad3f3e894a061ee94f5386dd9256051491fa4a.tar.xz slx-admin-4aad3f3e894a061ee94f5386dd9256051491fa4a.zip |
[rebootcontrol] Conditional rebuild of config.tgz, proper permissions for authorized_keys
Diffstat (limited to 'modules-available/rebootcontrol/hooks')
-rw-r--r-- | modules-available/rebootcontrol/hooks/config-tgz.inc.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules-available/rebootcontrol/hooks/config-tgz.inc.php b/modules-available/rebootcontrol/hooks/config-tgz.inc.php index 0b706960..90e32e8a 100644 --- a/modules-available/rebootcontrol/hooks/config-tgz.inc.php +++ b/modules-available/rebootcontrol/hooks/config-tgz.inc.php @@ -1,14 +1,15 @@ <?php $pubkey = SSHKey::getPublicKey(); -$tmpfile = '/tmp/bwlp-' . md5($pubkey) . '.tar'; +$tmpfile = '/tmp/bwlp-' . md5($pubkey) . '-2.tar'; if (!is_file($tmpfile) || !is_readable($tmpfile) || filemtime($tmpfile) + 86400 < time()) { if (file_exists($tmpfile)) { unlink($tmpfile); } try { $a = new PharData($tmpfile); - $a->addFromString("/root/.ssh/authorized_keys.d/rebootcontrol", $pubkey); + $a["/etc/ssh/mgmt/authorized_keys"] = $pubkey; + $a["/etc/ssh/mgmt/authorized_keys"]->chmod(0600); $file = $tmpfile; } catch (Exception $e) { EventLog::failure('Could not include ssh key for reboot-control in config.tgz', (string)$e); |