Skip to content

Commit

Permalink
Merge pull request #4 from PocketDock/0.0.6
Browse files Browse the repository at this point in the history
Fixed some 'security issues', RCON pass is the new default. No showing pass
  • Loading branch information
Humerus committed Nov 8, 2014
2 parents 4ef329b + 09d947a commit 54aa645
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/PocketDockConsole/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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":
Expand Down
4 changes: 0 additions & 4 deletions src/PocketDockConsole/SocksServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 54aa645

Please sign in to comment.