From c058e40fc11ba640e464173058119e2bb05f2c16 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 21 Sep 2017 12:56:24 +0200
Subject: [PATCH] Create .ssh folder in web root.

---
 server/plugins-available/apache2_plugin.inc.php | 7 +++++++
 server/plugins-available/nginx_plugin.inc.php   | 9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index e52a123550..a9b321f2cf 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -705,6 +705,13 @@ class apache2_plugin {
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
+		
+		if(!is_dir($data['new']['document_root'].'/.ssh')) {
+			$app->system->mkdirpath($data['new']['document_root'].'/.ssh');
+			$app->system->chmod($data['new']['document_root'].'/.ssh', 0700);
+			$app->system->chown($data['new']['document_root'].'/.ssh', $username);
+			$app->system->chgrp($data['new']['document_root'].'/.ssh', $groupname);
+		}
 
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 933010478f..6b7241ae2b 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -552,7 +552,14 @@ class nginx_plugin {
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		//if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
-
+		
+		if(!is_dir($data['new']['document_root'].'/.ssh')) {
+			$app->system->mkdirpath($data['new']['document_root'].'/.ssh');
+			$app->system->chmod($data['new']['document_root'].'/.ssh', 0700);
+			$app->system->chown($data['new']['document_root'].'/.ssh', $username);
+			$app->system->chgrp($data['new']['document_root'].'/.ssh', $groupname);
+		}
+		
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
 			$app->system->mkdirpath($data['new']['document_root'].'/private');
-- 
GitLab