Hanno Böck To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/ Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_once('inc/debug.php'); require_once('inc/security.php'); require_once('inc/jquery.php'); javascript(); require_once('vhosts.php'); require_once('certs.php'); $section = 'vhosts_vhosts'; require_role(ROLE_SYSTEMUSER); $id = (isset($_GET['vhost']) ? (int) $_GET['vhost'] : 0); $vhost = empty_vhost(); if ($id != 0) $vhost = get_vhost_details($id); $have_v6 = false; $server = (isset($vhost['server']) ? $vhost['server'] : $_SESSION['userinfo']['server']); if (ipv6_possible($server)) $have_v6 = true; DEBUG($vhost); if ($id == 0) { title("Neue Subdomain anlegen"); } else { title("Subdomain bearbeiten"); } $defaultdocroot = $vhost['domain']; if (! $vhost['domain']) { $defaultdocroot = $_SESSION['userinfo']['username'].'.'.config('masterdomain'); } if ($vhost['domain_id'] == -1) { $defaultdocroot = $_SESSION['userinfo']['username'].'.'.config('user_vhosts_domain'); } if ($vhost['hostname']) $defaultdocroot = $vhost['hostname'].'.'.$defaultdocroot; $defaultdocroot = $defaultdocroot.'/htdocs'; $is_default_docroot = ($vhost['docroot'] == NULL) || ($vhost['homedir'].'/websites/'.$defaultdocroot == $vhost['docroot']); if ($vhost['docroot'] != '' && ! strstr($vhost['docroot'], '/websites/')) { warning("Sie verwenden einen Speicherplatz außerhalb von »~/websites/«. Diese Einstellung ist momentan nicht mehr gestattet. Ihre Einstellung wurde daher auf die Standardeinstellung zurückgesetzt. Prüfen Sie dies bitte und verschieben Sie ggf. ihre Dateien."); $is_default_docroot = True; } $docroot = ''; if ($is_default_docroot) $docroot = $defaultdocroot; else $docroot = substr($vhost['docroot'], strlen($vhost['homedir'].'/websites/')); $s = (strstr($vhost['options'], 'aliaswww') ? ' checked="checked" ' : ''); $errorlog = ($vhost['errorlog'] == 1 ? ' checked="checked" ' : ''); $vhost_type = 'regular'; if ($vhost['is_dav']) $vhost_type = 'dav'; elseif ($vhost['is_svn']) $vhost_type = 'svn'; elseif ($vhost['is_webapp']) $vhost_type = 'webapp'; $applist = list_available_webapps(); $webapp_options = ''; foreach ($applist as $app) $webapp_options .= "\n"; $aliaswww_options = array("forwardwww" => "Umleiten auf www-Subdomain", "forwardnowww" => "Umleiten auf Stammdomain (ohne www)", "noforward" => "Keine Umleitung"); $aliaswww_option = 'forwardwww'; if (strstr($vhost['options'], 'aliaswww')) { // Wenn aliaswww gar nicht gesetzt war, dann soll die select-Option für forwardwww trotzdem auf dem default stehen. // Ist nicht sichtbar und wird beim Speichern auch wieder entfernt if (strstr($vhost['options'], 'forwardwww')) { $aliaswww_option = 'forwardwww'; } elseif (strstr($vhost['options'], 'forwardnowww')) { $aliaswww_option = 'forwardnowww'; } else { $aliaswww_option = 'noforward'; } } $form = "

Name des VHost

.".domainselect($vhost['domain_id']); $form .= "

".html_select('forwardwww', $aliaswww_options, $aliaswww_option)."

Optionen

Speicherort für Dateien (»Document Root«)
 
".$vhost['homedir']."/websites/ 
"; /* * Boolean option, to be used when only one PHP version is available */ $have_php = ($vhost['php'] == 'php56' ? ' checked="checked" ' : ''); /* $phpoptions = "
PHP
 
"; */ /* * Choose what PHP version to use */ //if ($vhost['php'] == 'php54') //{ $options = array("none" => 'ausgeschaltet', "php56" => "PHP 5.6 (veraltet)", "fpm70" => "PHP 7.0", "fpm71" => "PHP 7.1", "fpm72" => "PHP 7.2 (beta)"); $phpoptions = "
PHP
".html_select("php", $options, $vhost['php'])."
"; //} $safemode = ($vhost['cgi'] == 1 ? '' : ' checked="checked" '); $form .= "
".$phpoptions."
Abgesicherter Modus
 
(Deaktiviert CGI, mod_rewrite und einige weitere Funktionen mit denen die Website auf andere Orte des Home-Verzeichnisses zugreifen könnte.)
"; $form .= "

Optionen

Anwendung

Wenn Sie diese Option wählen, wird die Anwendung automatisch eingerichtet. Sie erhalten dann ihre Zugangsdaten per E-Mail.

"; $form .= "

Verwendung


"; if ($vhost_type=='webapp') { // Wird nur noch angezeigt wenn der Vhost schon auf webapp konfiguriert ist, ansonsten nicht. // Die User sollen den Webapp-Installer benutzen. $form .= "
"; } $hsts_value = $vhost['hsts']; $hsts_preset_values = array("-1" => "aus", "86400" => "1 Tag", "2592000" => "30 Tage", "31536000" => "1 Jahr", "63072000" => "2 Jahre", "custom" => "Individuell"); $hsts_preset_value = 'custom'; if (isset($hsts_preset_values[$hsts_value])) { $hsts_preset_value = $hsts_value; } $form .= "



Optionen

Sichere Verbindung erzwingen
".html_select('hsts_preset', $hsts_preset_values, $hsts_preset_value)." Sekunden

"; $certs = user_certs(); $certselect = array(0 => 'kein Zertifikat / System-Standard benutzen', -1 => 'Automatische Zertifikatsverwaltung mit Let\'s Encrypt'); foreach ($certs as $c) { $certselect[$c['id']] = $c['subject']; } if (strstr($vhost['options'], 'letsencrypt')) { $vhost['certid'] = -1; } $form .= "
verwendetes Zertifikat
".html_select('cert', $certselect, $vhost['certid'])."

Datenschutz-Hinweis:
Alle erstellten HTTPS-Zertifikate werden automatisch in den für jeden zugänglichen Certificate-Transparency-Logs abgelegt. Die zugehörigen Subdomains sind damit auch öffentlich. Sie können die Logs mit dem Service crt.sh durchsuchen.

"; $form.="
Logfiles

 
 

Logfiles werden unter /var/log/apache2/".$_SESSION['userinfo']['username']." abgelegt.

"; $ipaddrs = user_ipaddrs(); $available_users = available_suexec_users(); $available_servers = additional_servers(); $available_servers[] = my_server_id(); $available_servers = array_unique($available_servers); $selectable_servers = array(); $all_servers = server_names(); foreach ($all_servers as $id => $fqdn) { if (in_array($id, $available_servers)) { $selectable_servers[$id] = $fqdn; } } if (!$vhost['server']) { $vhost['server'] = my_server_id(); } if (count($ipaddrs)) { $ipselect = array(0 => 'System-Standard'); foreach ($ipaddrs AS $i) { $ipselect[$i] = $i; } $form .= "
IP-Adresse
".html_select('ipv4', $ipselect, $vhost['ipv4'])."
"; } if (count($available_users)) { $userselect = array(0 => 'Eigener Benutzeraccount'); foreach ($available_users AS $u) { $userselect[$u['uid']] = $u['username']; } $form .= "
SuExec-Benutzeraccount
".html_select('suexec_user', $userselect, $vhost['suexec_user'])."
"; } if (count($available_servers) > 1) { $form .= "
Einrichten auf Server
".html_select('server', $selectable_servers, $vhost['server'])."
"; } if ($have_v6) { $ipv6_address = ''; if ($vhost['id'] && ($vhost['autoipv6'] >0 )) $ipv6_address = 'IPv6-Adresse dieser Subdomain: '.autoipv6_address($vhost['id'], $vhost['autoipv6']); $checked = ($vhost['autoipv6'] > 0) ? ' checked="checked"' : ''; $checked2 = ($vhost['autoipv6'] == 2) ? ' checked="checked"' : ''; $form .= '
IPv6
 
 
'.$ipv6_address.'
'; } $form .= '

    '.internal_link('vhosts', 'Abbrechen').'

'; output(html_form('vhosts_edit_vhost', 'save', 'action=edit&vhost='.$vhost['id'], $form)); ?>