From 161180cdf4e915526bc8d62c0301a09130fbf59e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 6 Feb 2015 16:12:45 +0100 Subject: Add sshd config module --- inc/configmodule/sshconfig.inc.php | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 inc/configmodule/sshconfig.inc.php (limited to 'inc/configmodule/sshconfig.inc.php') diff --git a/inc/configmodule/sshconfig.inc.php b/inc/configmodule/sshconfig.inc.php new file mode 100644 index 00000000..853acf6a --- /dev/null +++ b/inc/configmodule/sshconfig.inc.php @@ -0,0 +1,63 @@ +validateConfig()) + return false; + $config = $this->moduleData + array( + 'filename' => $tgz, + 'failOnParentFail' => false, + 'parent' => $parent + ); + // Create config module, which will also check if the pubkey is valid + return Taskmanager::submit('SshdConfigGenerator', $config); + } + + protected function moduleVersion() + { + return self::VERSION; + } + + protected function validateConfig() + { + return isset($this->moduleData['publicKey']) && isset($this->moduleData['allowPasswordLogin']) && isset($this->moduleData['listenPort']); + } + + public function setData($key, $value) + { + switch ($key) { + case 'publicKey': + break; + case 'allowPasswordLogin': + if ($value === true || $value === 'yes') + $value = 'yes'; + elseif ($value === false || $value === 'no') + $value = 'no'; + else + return false; + break; + case 'listenPort': + if (!is_numeric($value) || $value < 1 || $value > 65535) + return false; + break; + default: + return false; + } + $this->moduleData[$key] = $value; + return true; + } + +} -- cgit v1.2.3-55-g7522