Skip to content

Commit 54aa645

Browse files
committed
Merge pull request #4 from PocketDock/0.0.6
Fixed some 'security issues', RCON pass is the new default. No showing pass
2 parents 4ef329b + 09d947a commit 54aa645

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PocketDockConsole
22
prefix: PDC
33
main: PocketDockConsole\Main
4-
version: 0.0.6
4+
version: 0.0.7
55
api: [1.0.0]
66

77
load: POSTWORLD

src/PocketDockConsole/Main.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function onEnable() {
2323
$this->saveDefaultConfig();
2424
$this->reloadConfig();
2525
$this->getLogger()->info(TextFormat::DARK_GREEN . "Enabled");
26+
$this->setPassword();
2627
$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"));
2728
$this->rc = new RunCommand($this);
2829
$this->getServer()->getScheduler()->scheduleRepeatingTask($this->rc, 1);
@@ -31,6 +32,16 @@ public function onEnable() {
3132
$this->getServer()->getLogger()->addAttachment($this->attachment);
3233
}
3334

35+
public function setPassword() {
36+
if ($this->getConfig()->get("password") == "PocketDockRules!") {
37+
$this->getConfig()->set("password", $this->getServer()->getConfigString("rcon.password", ""));
38+
$this->getLogger()->info("The password is now the RCON password.");
39+
$this->getLogger()->info("If you would like to change the password, please do so in the PDC config.");
40+
$this->getConfig()->save();
41+
$this->reloadConfig();
42+
}
43+
}
44+
3445
public function onCommand(CommandSender $sender, Command $command, $label, array $args) {
3546
switch ($command->getName()) {
3647
case "consoleclients":

src/PocketDockConsole/SocksServer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ public function __construct($host, $port, $logger, $loader, $password, $html, $b
3434
$this->loadPaths = array_reverse($loadPaths);
3535
$this->start(PTHREADS_INHERIT_ALL & ~PTHREADS_INHERIT_CLASSES);
3636
$this->log("Started SocksServer on " . $this->host . ":" . $this->port);
37-
$this->log("Authentication password is: " . $this->password);
38-
if ($this->password === "PocketDockRules!") {
39-
$this->log("You are using the default password! Please change the password in config.yml");
40-
}
4137
}
4238

4339
protected function addDependency(array & $loadPaths, \ReflectionClass $dep) {

0 commit comments

Comments
 (0)