config perms
authorChristian Weiske <cweiske@cweiske.de>
Tue, 6 Sep 2016 14:22:38 +0000 (16:22 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 6 Sep 2016 14:22:38 +0000 (16:22 +0200)
src/shpub/Config.php

index 9a2370507b0ca9fb11e53e620e59792f818c6d80..044b1504ab4ff87c7b21621d079e4187176bb155 100644 (file)
@@ -67,7 +67,14 @@ class Config
                 $str .= $hostProp . '=' . $hostVal . "\n";
             }
         }
                 $str .= $hostProp . '=' . $hostVal . "\n";
             }
         }
-        file_put_contents($this->getConfigFilePath(), $str);
+        $cfgFilePath = $this->getConfigFilePath();
+        $cfgDir = dirname($cfgFilePath);
+        if (!is_dir($cfgDir)) {
+            mkdir($cfgDir);
+        }
+        file_put_contents($cfgFilePath, $str);
+        //contains sensitive data; nobody else may read that
+        chmod($cfgFilePath, 0600);
     }
 
     public function getDefaultHost()
     }
 
     public function getDefaultHost()