From 09d947a9c54053dcceee22b41be02bafe52d6e18 Mon Sep 17 00:00:00 2001 From: Humerus Date: Sat, 8 Nov 2014 13:50:54 -0500 Subject: [PATCH] Fixed some 'security issues', RCON pass is the new default, change it in the config file --- plugin.yml | 2 +- src/PocketDockConsole/Main.php | 11 +++++++++++ src/PocketDockConsole/SocksServer.php | 4 ---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugin.yml b/plugin.yml index 7f0678b..8ae6bc2 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: PocketDockConsole prefix: PDC main: PocketDockConsole\Main -version: 0.0.6 +version: 0.0.7 api: [1.0.0] load: POSTWORLD diff --git a/src/PocketDockConsole/Main.php b/src/PocketDockConsole/Main.php index 3993e14..9a04df4 100644 --- a/src/PocketDockConsole/Main.php +++ b/src/PocketDockConsole/Main.php @@ -23,6 +23,7 @@ public function onEnable() { $this->saveDefaultConfig(); $this->reloadConfig(); $this->getLogger()->info(TextFormat::DARK_GREEN . "Enabled"); + $this->setPassword(); $this->thread = new SocksServer("0.0.0.0", $this->getConfig()->get("port"), $this->getServer()->getLogger(), $this->getServer()->getLoader(), $this->getConfig()->get("password"), stream_get_contents($this->getResource("PluginIndex.html")), $this->getConfig()->get("backlog")); $this->rc = new RunCommand($this); $this->getServer()->getScheduler()->scheduleRepeatingTask($this->rc, 1); @@ -31,6 +32,16 @@ public function onEnable() { $this->getServer()->getLogger()->addAttachment($this->attachment); } + public function setPassword() { + if ($this->getConfig()->get("password") == "PocketDockRules!") { + $this->getConfig()->set("password", $this->getServer()->getConfigString("rcon.password", "")); + $this->getLogger()->info("The password is now the RCON password."); + $this->getLogger()->info("If you would like to change the password, please do so in the PDC config."); + $this->getConfig()->save(); + $this->reloadConfig(); + } + } + public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch ($command->getName()) { case "consoleclients": diff --git a/src/PocketDockConsole/SocksServer.php b/src/PocketDockConsole/SocksServer.php index 7ee5610..da8027f 100644 --- a/src/PocketDockConsole/SocksServer.php +++ b/src/PocketDockConsole/SocksServer.php @@ -34,10 +34,6 @@ public function __construct($host, $port, $logger, $loader, $password, $html, $b $this->loadPaths = array_reverse($loadPaths); $this->start(PTHREADS_INHERIT_ALL & ~PTHREADS_INHERIT_CLASSES); $this->log("Started SocksServer on " . $this->host . ":" . $this->port); - $this->log("Authentication password is: " . $this->password); - if ($this->password === "PocketDockRules!") { - $this->log("You are using the default password! Please change the password in config.yml"); - } } protected function addDependency(array & $loadPaths, \ReflectionClass $dep) {