diff --git a/var/www/common.php b/var/www/common.php index 06bcd74..4b0c648 100644 --- a/var/www/common.php +++ b/var/www/common.php @@ -93,6 +93,7 @@ const CONTACT_URL = 'https://danwin1210.de/contact.php'; //url to contact form const PRIVACY_URL = 'https://danwin1210.de/privacy.php'; //url to privacy policy const SOFTWARE_URL = 'https://github.com/DanWin/hosting'; const CLEARNET = '0'; // clearnet enabled = 1 or 0 disabled +const PUB_ONION_DESC = '0'; //enable public onion description, 0 = disabled, 1 = enabled const CLEARNET_A = '116.202.17.147'; // IPv4 Address of your clearnet gateway const CLEARNET_AAAA = '2a01:4f8:c010:d56::1'; // IPv6 Address of your clearnet gateway const CLEARNET_ADDRESS = 'hosting.danwin1210.me'; //Domain under which the service is reachable in clearnet diff --git a/var/www/cron.php b/var/www/cron.php index 2334dbb..2278c5a 100644 --- a/var/www/cron.php +++ b/var/www/cron.php @@ -36,7 +36,36 @@ while($account=$stmt->fetch(PDO::FETCH_ASSOC)){ $reload[$account['instance']] = true; //add and manage rights of system user $shell = ENABLE_SHELL_ACCESS ? '/bin/bash' : '/usr/sbin/nologin'; - exec('useradd -l -g www-data -k /var/www/skel -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account)); + exec('useradd -l -g www-data -m -s ' . escapeshellarg($shell) . ' ' . escapeshellarg($system_account)); + //generate default hosting page + $home = "/home/$system_account"; + $dir = "$home/www"; + $file = "$dir/index.hosting.html"; + if (!is_dir($dir)) { + mkdir($dir, 0755, true); + } + $content = sprintf( + ' + +
+ +This site is hosted by %s service.
+ + ', + htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'), + htmlspecialchars(ADDRESS, ENT_QUOTES, 'UTF-8'), + htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8') + ); + file_put_contents($file, $content); + chown($dir, $system_account); + chgrp($dir, 'www-data'); + chown($file, $system_account); + chgrp($file, 'www-data'); + //////// update_system_user_password($system_account, $account['password']); setup_chroot($system_account, $last_account); $last_account = $system_account; diff --git a/var/www/html/home.php b/var/www/html/home.php index 1a3fc23..8b5e4c8 100644 --- a/var/www/html/home.php +++ b/var/www/html/home.php @@ -131,10 +131,15 @@ if(isset($_REQUEST['action']) && isset($_REQUEST['onion']) && $_REQUEST['action' if($error=check_csrf_error()){ die($error); } - $stmt=$db->prepare('SELECT onions.version, onions.instance FROM onions INNER JOIN users ON (users.id=onions.user_id) WHERE onions.onion = ? AND users.id = ? AND onions.enabled IN (0, 1);'); + //$stmt=$db->prepare('SELECT onions.version, onions.instance FROM onions INNER JOIN users ON (users.id=onions.user_id) WHERE onions.onion = ? AND users.id = ? AND onions.enabled IN (0, 1);'); + $stmt=$db->prepare('SELECT onions.version, onions.instance, onions.description FROM onions INNER JOIN users ON (users.id=onions.user_id) WHERE onions.onion = ? AND users.id = ? AND onions.enabled IN (0, 1);'); + $description = trim($_POST['description'] ?? $_REQUEST['description'] ?? ''); + $description = mb_substr($description, 0, 50); // Limit 50 + $stmt->execute([$_REQUEST['onion'], $user['id']]); if($onion=$stmt->fetch(PDO::FETCH_ASSOC)){ - $stmt=$db->prepare('UPDATE onions SET enabled = ?, enable_smtp = ?, num_intros = ?, max_streams = ? WHERE onion = ?;'); + //$stmt=$db->prepare('UPDATE onions SET enabled = ?, enable_smtp = ?, num_intros = ?, max_streams = ? WHERE onion = ?;'); + $stmt=$db->prepare('UPDATE onions SET enabled = ?,enable_smtp = ?,num_intros = ?,max_streams = ?,description = ?WHERE onion = ?;'); $enabled = isset($_REQUEST['enabled']) ? 1 : 0; $enable_smtp = isset($_REQUEST['enable_smtp']) ? 1 : 0; $num_intros = intval($_REQUEST['num_intros']); @@ -151,7 +156,8 @@ if(isset($_REQUEST['action']) && isset($_REQUEST['onion']) && $_REQUEST['action' }elseif($max_streams>65535){ $max_streams = 65535; } - $stmt->execute([$enabled, $enable_smtp, $num_intros, $max_streams, $_REQUEST['onion']]); + //$stmt->execute([$enabled, $enable_smtp, $num_intros, $max_streams, $_REQUEST['onion']]); + $stmt->execute([$enabled,$enable_smtp,$num_intros,$max_streams,$description,$_REQUEST['onion']]); enqueue_instance_reload($onion['instance']); } } @@ -176,8 +182,10 @@ if(!empty($msg)){ echo ''.sprintf(_('Enter system account password to check your %s mail:'), $user['system_account'].'@' . ADDRESS).'
| '._('Onion').' | '._('Private key').' | '._('Enabled').' | '._('SMTP enabled').' | '._('Nr. of intros').' | '._('Max streams per rend circuit').' | '._('Action').' | |
|---|---|---|---|---|---|---|---|
| '._('Onion').' | '._('Private key').' | '._('Enabled').' | '._('SMTP enabled').' | '._('Nr. of intros').' | '._('Max streams per rend circuit').' | '._('Action').' | |
| '._('Onion').' | '._('Private key').' | '._('Enabled').' | '._('SMTP enabled').' | '._('Nr. of intros').' | '._('Max streams per rend circuit').' | '._('Description').' | '._('Action').' | '; echo ' | '; + //added description + echo ' | '; if(in_array($onion['enabled'], [0, 1])){ echo ' | '; echo ' | '; @@ -206,7 +216,8 @@ while($onion=$stmt->fetch(PDO::FETCH_ASSOC)){ } if($count_onions
| '._('Add additional hidden service:').' '; + //echo ' | |||||||
| '._('Add additional hidden service:').' '; + echo ' | |||||||
| '._('Add additional hidden service:').' '; echo ''; @@ -219,6 +230,7 @@ if($count_onions | |||||||
'.sprintf(_('To enable your clearnet domain, edit your DNS settings and enter %1$s as your A record and %2$s as your AAAA record. Once you have modified your DNS settings, contact me to configure the SSL certificate. You may also use any subdomain of %4$s'), CLEARNET_A, CLEARNET_AAAA, CONTACT_URL, CLEARNET_SUBDOMAINS).'
'; } +endif; echo '| '._('Database').' | '._('Host').' | '._('User').' | '._('Action').' |
|---|