From 023239571021ed92e57861096efcf073b685194c Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:27:39 +0100 Subject: [PATCH 1/7] Update index.php added backlink --- var/www/html/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/html/index.php b/var/www/html/index.php index e840d32..83260d0 100644 --- a/var/www/html/index.php +++ b/var/www/html/index.php @@ -54,4 +54,5 @@ print_header(_('Info'));
  • +Based on Daniels Hosting'), SOFTWARE_URL); ?> From 22442e5dc9b8851462d635af1e11a9581a845664 Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:31:01 +0100 Subject: [PATCH 2/7] Update home.php added condition, when CLEARNET = 0 then disable clearnet option on home.php --- var/www/html/home.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/www/html/home.php b/var/www/html/home.php index 1a3fc23..d006950 100644 --- a/var/www/html/home.php +++ b/var/www/html/home.php @@ -219,6 +219,7 @@ if($count_onions'; } echo ''; +if (defined('CLEARNET') && CLEARNET !== '0'): if(MAX_NUM_USER_DOMAINS>0){ echo '

    '._('Clearnet domains').'

    '; echo ''; @@ -251,6 +252,7 @@ if(MAX_NUM_USER_DOMAINS>0){ echo '
    '; echo '

    '.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 '

    '._('MySQL Database').'

    '; echo ''; echo ''; From 539a31f5673c662278442ee1a71cd47baff7644d Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:45:09 +0100 Subject: [PATCH 3/7] Update setup.php added column description for onion domains, used later in home.php and can also enabled or disabled on public onion list.php via common.php --- var/www/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/www/setup.php b/var/www/setup.php index fcdd41d..604fc56 100644 --- a/var/www/setup.php +++ b/var/www/setup.php @@ -25,7 +25,7 @@ if(!$version){ $db->exec("CREATE TABLE new_account (user_id int(11) NOT NULL PRIMARY KEY, password varchar(255) COLLATE latin1_bin NOT NULL, approved tinyint(1) UNSIGNED NOT NULL DEFAULT '0', CONSTRAINT new_account_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;"); $db->exec('CREATE TABLE pass_change (user_id int(11) NOT NULL PRIMARY KEY, password varchar(255) COLLATE latin1_bin NOT NULL, CONSTRAINT pass_change_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;'); $db->exec('CREATE TABLE mysql_databases (user_id int(11) NOT NULL, mysql_database varchar(64) COLLATE latin1_bin NOT NULL, KEY user_id (user_id), CONSTRAINT mysql_database_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;'); - $db->exec("CREATE TABLE onions (user_id int(11) NULL, onion varchar(56) COLLATE latin1_bin NOT NULL PRIMARY KEY, private_key varchar(1000) COLLATE latin1_bin NOT NULL, version tinyint(1) NOT NULL, enabled tinyint(1) NOT NULL DEFAULT '1', num_intros tinyint(3) NOT NULL DEFAULT '3', enable_smtp tinyint(1) NOT NULL DEFAULT '1', max_streams tinyint(3) unsigned NOT NULL DEFAULT '6', instance char(1) NOT NULL DEFAULT '2', KEY user_id (user_id), KEY enabled (enabled), KEY instance(instance), CONSTRAINT onions_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT instance_ibfk_1 FOREIGN KEY (instance) REFERENCES service_instances (id) ON DELETE RESTRICT ON UPDATE RESTRICT) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;"); + $db->exec("CREATE TABLE onions (user_id int(11) NULL, onion varchar(56) COLLATE latin1_bin NOT NULL PRIMARY KEY, description varchar(100) COLLATE latin1_bin NULL, private_key varchar(1000) COLLATE latin1_bin NOT NULL, version tinyint(1) NOT NULL, enabled tinyint(1) NOT NULL DEFAULT '1', num_intros tinyint(3) NOT NULL DEFAULT '3', enable_smtp tinyint(1) NOT NULL DEFAULT '1', max_streams tinyint(3) unsigned NOT NULL DEFAULT '6', instance char(1) NOT NULL DEFAULT '2', KEY user_id (user_id), KEY enabled (enabled), KEY instance(instance), CONSTRAINT onions_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT instance_ibfk_1 FOREIGN KEY (instance) REFERENCES service_instances (id) ON DELETE RESTRICT ON UPDATE RESTRICT) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;"); $db->exec("CREATE TABLE domains (user_id int(11) NULL, domain varchar(255) COLLATE latin1_bin NOT NULL PRIMARY KEY, enabled tinyint(1) NOT NULL DEFAULT '1', KEY user_id (user_id), KEY enabled (enabled), CONSTRAINT domains_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;"); $db->exec("CREATE TABLE disk_quota (user_id int(11) NOT NULL, quota_size int(10) unsigned NOT NULL, quota_files int(10) unsigned NOT NULL, updated tinyint(1) NOT NULL DEFAULT 1, quota_size_used int(10) unsigned NOT NULL DEFAULT '0', quota_files_used int(10) unsigned NOT NULL DEFAULT '0', KEY user_id (user_id), KEY updated (updated), CONSTRAINT disk_quota_ibfk_2 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;"); $db->exec('CREATE TABLE nginx_rewrites (id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id int(11) NOT NULL, `regex` varchar(255) NOT NULL, replacement varchar(255) NOT NULL, `flag` varchar(9) NOT NULL, ifnotexists tinyint(1) NOT NULL, CONSTRAINT nginx_rewrites_ibfk_2 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;'); From af5490dc7c748a721df964970b4c5d4f5d8bb6d3 Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:50:27 +0100 Subject: [PATCH 4/7] Update common.php added const for public onion description, when enabled desc shows on list.php --- var/www/common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/common.php b/var/www/common.php index 5bda0a7..9ecafd7 100644 --- a/var/www/common.php +++ b/var/www/common.php @@ -91,6 +91,7 @@ const SITE_NAME = "Daniel's Hosting"; //globally changes the sites title const HOME_MOUNT_PATH = '/home'; //mount path of the home directory. Usually /home as own partition or / on a system with no extra home partition 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 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 From 87c1d317d69654e346f10b39923ad8856eb5185e Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:37:08 +0100 Subject: [PATCH 5/7] Update home.php added description to select and update, added description field --- var/www/html/home.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/var/www/html/home.php b/var/www/html/home.php index 1a3fc23..f688727 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).'

    '._('Database').''._('Host').''._('User').''._('Action').'

    '; echo '

    '._('Onion domains').'

    '; echo ''; -echo ''; -$stmt=$db->prepare('SELECT onion, private_key, enabled, enable_smtp, num_intros, max_streams FROM onions WHERE user_id = ?;'); +//echo ''; +echo ''; +//$stmt=$db->prepare('SELECT onion, private_key, enabled, enable_smtp, num_intros, max_streams FROM onions WHERE user_id = ?;'); +$stmt=$db->prepare('SELECT onion, private_key, enabled, enable_smtp, num_intros, max_streams, description FROM onions WHERE user_id = ?;'); $stmt->execute([$user['id']]); $count_onions = 0; while($onion=$stmt->fetch(PDO::FETCH_ASSOC)){ @@ -196,6 +204,8 @@ while($onion=$stmt->fetch(PDO::FETCH_ASSOC)){ echo '>'._('Enabled').''; echo ''; echo ''; + //added description + echo ''; if(in_array($onion['enabled'], [0, 1])){ echo ''; @@ -206,7 +216,8 @@ while($onion=$stmt->fetch(PDO::FETCH_ASSOC)){ } if($count_onions"; - echo '
    '._('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 '
    '._('Add additional hidden service:').'
    '; + //echo '
    '._('Add additional hidden service:').'
    '; + echo '
    '._('Add additional hidden service:').'
    '; echo ''; From 5ad393b982a63bb9a06de794a67a41849a4b9f6b Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:49:33 +0100 Subject: [PATCH 6/7] Update list.php added select with description, only visible when PUB_ONION_DESC = 1 in common.php --- var/www/html/list.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/var/www/html/list.php b/var/www/html/list.php index 5d6468a..f3061ab 100644 --- a/var/www/html/list.php +++ b/var/www/html/list.php @@ -3,6 +3,7 @@ require_once('../common.php'); header('Content-Type: text/html; charset=UTF-8'); $db = get_db_instance(); print_header(_('List of hosted sites'), 'td{padding:5px;}', '_blank'); +$show_desc = (defined('PUB_ONION_DESC') && (string)PUB_ONION_DESC === '1'); ?>

    query('SELECT COUNT(*) FROM users WHERE public=0;'); $hidden=$stmt->fetch(PDO::FETCH_NUM); echo '

    '.sprintf(_('Here is a list of %1$d public hosted sites (%2$d sites hidden):'), $count[0], $hidden[0]).'

    '; echo ''; -echo ''; -$stmt=$db->query('SELECT onions.onion FROM users INNER JOIN onions ON (onions.user_id=users.id) WHERE users.public=1 ORDER BY onions.onion;'); -while($tmp=$stmt->fetch(PDO::FETCH_NUM)){ - echo ""; +echo ''; +if ($show_desc) { + echo ''; } +echo ''; +// description only when PUB_ONION_DESC = 1 in common.php +if ($show_desc) { + $stmt=$db->query('SELECT onions.onion, onions.description FROM users INNER JOIN onions ON (onions.user_id=users.id) WHERE users.public=1 ORDER BY onions.onion;'); + while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ + $onion = $row['onion']; + $desc = htmlspecialchars($row['description'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + echo ""; + } +} else { + $stmt=$db->query('SELECT onions.onion FROM users INNER JOIN onions ON (onions.user_id=users.id) WHERE users.public=1 ORDER BY onions.onion;'); + while($row=$stmt->fetch(PDO::FETCH_NUM)){ + $onion = $row[0]; + echo ""; + } +} +echo '
    '._('Onion link').'
    $tmp[0].onion
    '._('Onion link').''._('Description').'
    $onion.onion$desc
    $onion.onion
    '; ?> -
    From 900d65c4f020cc29c24a4bb0a588ecea0236ba19 Mon Sep 17 00:00:00 2001 From: Lin <31387258+011248163264@users.noreply.github.com> Date: Wed, 25 Feb 2026 20:08:29 +0100 Subject: [PATCH 7/7] Update cron.php the default hosting page is generated with site_name and address from the common.php --- var/www/cron.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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( + ' + + + + Site hosted by %s service + + + +

    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;