Added support for mail() inside chroots
This commit is contained in:
@ -277,10 +277,11 @@ function send_captcha() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function check_login(){
|
function check_login(){
|
||||||
|
session_start();
|
||||||
if(empty($_SESSION['csrf_token'])){
|
if(empty($_SESSION['csrf_token'])){
|
||||||
$_SESSION['csrf_token']=sha1(uniqid());
|
$_SESSION['csrf_token']=sha1(uniqid());
|
||||||
}
|
}
|
||||||
if(empty($_SESSION['hosting_username'])){
|
if(empty($_SESSION['hosting_username']) || !empty($_SESSION['2fa_code'])){
|
||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
session_destroy();
|
session_destroy();
|
||||||
exit;
|
exit;
|
||||||
@ -569,16 +570,31 @@ function rewrite_nginx_config(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
file_put_contents("/etc/nginx/sites-enabled/hosted_sites", $nginx);
|
file_put_contents("/etc/nginx/sites-enabled/hosted_sites", $nginx);
|
||||||
$nginx='';
|
unset($nginx);
|
||||||
|
$nginx_mysql='';
|
||||||
|
$nginx_mail='';
|
||||||
$stmt=$db->query("SELECT system_account FROM users WHERE id NOT IN (SELECT user_id FROM new_account) AND todelete!=1;");
|
$stmt=$db->query("SELECT system_account FROM users WHERE id NOT IN (SELECT user_id FROM new_account) AND todelete!=1;");
|
||||||
while($tmp=$stmt->fetch(PDO::FETCH_ASSOC)){
|
while($tmp=$stmt->fetch(PDO::FETCH_ASSOC)){
|
||||||
$nginx.="server {
|
$nginx_mysql.="server {
|
||||||
listen unix:/home/$tmp[system_account]/var/run/mysqld/mysqld.sock;
|
listen unix:/home/$tmp[system_account]/var/run/mysqld/mysqld.sock;
|
||||||
proxy_pass unix:/var/run/mysqld/mysqld.sock;
|
proxy_pass unix:/var/run/mysqld/mysqld.sock;
|
||||||
}
|
}
|
||||||
";
|
";
|
||||||
|
$nginx_mail.="server {
|
||||||
|
listen unix:/home/$tmp[system_account]/var/run/mail.sock;
|
||||||
|
root /var/www/mail;
|
||||||
|
location / {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_param MAIL_USER $tmp[system_account];
|
||||||
|
fastcgi_param DOCUMENT_ROOT /var/www/mail;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/mail\$fastcgi_script_name;
|
||||||
|
fastcgi_pass unix:/var/run/php/7.4-mail;
|
||||||
}
|
}
|
||||||
file_put_contents("/etc/nginx/streams-enabled/hosted_sites", $nginx);
|
}
|
||||||
|
";
|
||||||
|
}
|
||||||
|
file_put_contents("/etc/nginx/streams-enabled/hosted_sites", $nginx_mysql);
|
||||||
|
file_put_contents("/etc/nginx/sites-enabled/hosted_sites_mail", $nginx_mail);
|
||||||
exec('systemctl reload nginx');
|
exec('systemctl reload nginx');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,6 +629,7 @@ php_admin_value[disable_functions] = pcntl_alarm,pcntl_async_signals,pcntl_exec,
|
|||||||
php_admin_value[upload_tmp_dir] = /tmp
|
php_admin_value[upload_tmp_dir] = /tmp
|
||||||
php_admin_value[soap.wsdl_cache_dir] = /tmp
|
php_admin_value[soap.wsdl_cache_dir] = /tmp
|
||||||
php_admin_value[session.save_path] = /tmp
|
php_admin_value[session.save_path] = /tmp
|
||||||
|
php_admin_value[sendmail_path] = '/usr/bin/php -r eval\(base64_decode\(\\\"JGM9Y3VybF9pbml0KCcxJyk7Y3VybF9zZXRvcHRfYXJyYXkoJGMsW0NVUkxPUFRfVU5JWF9TT0NLRVRfUEFUSD0+Jy92YXIvcnVuL21haWwuc29jaycsQ1VSTE9QVF9QT1NURklFTERTPT5bJ2NvbnRlbnQnPT5maWxlX2dldF9jb250ZW50cygncGhwOi8vc3RkaW4nKV1dKTtjdXJsX2V4ZWMoJGMpOwo=\\\"\)\)\;'
|
||||||
env[HOME]=/
|
env[HOME]=/
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include('../common.php');
|
include('../common.php');
|
||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
$msg='';
|
$msg='';
|
||||||
if($_SERVER['REQUEST_METHOD']==='POST'){
|
if($_SERVER['REQUEST_METHOD']==='POST'){
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include('../common.php');
|
include('../common.php');
|
||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
if(!empty($_POST['ftp_pass'])){
|
if(!empty($_POST['ftp_pass'])){
|
||||||
$_SESSION['ftp_pass']=$_POST['ftp_pass'];
|
$_SESSION['ftp_pass']=$_POST['ftp_pass'];
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include('../common.php');
|
include('../common.php');
|
||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
header('Content-Type: text/html; charset=UTF-8');
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
if(isset($_POST['action']) && $_POST['action']==='add_db'){
|
if(isset($_POST['action']) && $_POST['action']==='add_db'){
|
||||||
@ -326,7 +325,7 @@ $usage_text = bytes_to_human_readable($quota['quota_size_used'] * 1024) . ' of '
|
|||||||
$usage_files_text = "$quota[quota_files_used] of $quota[quota_files] - " . round($quota_files_usage * 100, 2).'%';
|
$usage_files_text = "$quota[quota_files_used] of $quota[quota_files] - " . round($quota_files_usage * 100, 2).'%';
|
||||||
?>
|
?>
|
||||||
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <a href="upgrade.php?upgrade=1g_quota">Upgrade</a></p>
|
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <a href="upgrade.php?upgrade=1g_quota">Upgrade</a></p>
|
||||||
<p>Your file number usage: <meter value="<?php echo round($quota_file_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a></p>
|
<p>Your file number usage: <meter value="<?php echo round($quota_files_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a></p>
|
||||||
<h3>Logs</h3>
|
<h3>Logs</h3>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
<tr><th>Date</th><th>access.log</th><th>error.log</th></tr>
|
<tr><th>Date</th><th>access.log</th><th>error.log</th></tr>
|
||||||
|
@ -25,7 +25,7 @@ header('X-Accel-Expires: 60');
|
|||||||
<li>FTP and SFTP access</li>
|
<li>FTP and SFTP access</li>
|
||||||
<li>command line access to shell via SSH</li>
|
<li>command line access to shell via SSH</li>
|
||||||
<li>1GB disk quota and a maximum of 100.000 files. - upgradable</li>
|
<li>1GB disk quota and a maximum of 100.000 files. - upgradable</li>
|
||||||
<li>mail() can send e-mails from your.onion@<?php echo ADDRESS; ?> (your.onion@hosting.danwin1210.me for clearnet) - not yet working but will return in future, use <a href="https://github.com/PHPMailer/PHPMailer" target="_blank">https://github.com/PHPMailer/PHPMailer</a> or similar for now</li>
|
<li>mail() can send e-mails from your_system_account@<?php echo ADDRESS; ?> (your_system_account@hosting.danwin1210.me for clearnet)</li>
|
||||||
<li>Webmail and IMAP, POP3 and SMTP access to your mail account</li>
|
<li>Webmail and IMAP, POP3 and SMTP access to your mail account</li>
|
||||||
<li>Mail sent to anything@your.onion gets automatically redirected to your inbox</li>
|
<li>Mail sent to anything@your.onion gets automatically redirected to your inbox</li>
|
||||||
<li>Your own .onion domains</li>
|
<li>Your own .onion domains</li>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include('../common.php');
|
include('../common.php');
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
if(!isset($_REQUEST['old']) || $_REQUEST['old']==0){
|
if(!isset($_REQUEST['old']) || $_REQUEST['old']==0){
|
||||||
$old='';
|
$old='';
|
||||||
|
@ -3,7 +3,7 @@ include('../common.php');
|
|||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
header('Content-Type: text/html; charset=UTF-8');
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
session_start();
|
session_start();
|
||||||
if(!empty($_SESSION['hosting_username'])){
|
if(!empty($_SESSION['hosting_username']) && empty($_SESSION['2fa_code'])){
|
||||||
header('Location: home.php');
|
header('Location: home.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include('../common.php');
|
include('../common.php');
|
||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
if(!isset($_REQUEST['type'])){
|
if(!isset($_REQUEST['type'])){
|
||||||
$_REQUEST['type']='acc';
|
$_REQUEST['type']='acc';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../common.php');
|
require('../common.php');
|
||||||
session_start();
|
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
use chillerlan\QRCode\QRCode;
|
use chillerlan\QRCode\QRCode;
|
||||||
use chillerlan\QRCode\QROptions;
|
use chillerlan\QRCode\QROptions;
|
||||||
@ -27,7 +26,11 @@ if($rates === false){
|
|||||||
<select name="upgrade">
|
<select name="upgrade">
|
||||||
<?php
|
<?php
|
||||||
foreach(ACCOUNT_UPGRADES as $name => $upgrade){
|
foreach(ACCOUNT_UPGRADES as $name => $upgrade){
|
||||||
echo '<option value="'.htmlspecialchars($name).'">'.htmlspecialchars($upgrade['name']).' ($'.$upgrade['usd_price'].')</option>';
|
echo '<option value="'.htmlspecialchars($name).'"';
|
||||||
|
if(isset($_REQUEST['upgrade']) && $name===$_REQUEST['upgrade']){
|
||||||
|
echo ' selected';
|
||||||
|
}
|
||||||
|
echo '>'.htmlspecialchars($upgrade['name']).' ($'.$upgrade['usd_price'].')</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
16
var/www/mail/index.php
Normal file
16
var/www/mail/index.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
$head = true;
|
||||||
|
$content = str_replace("\r\n", "\n", $_POST['content']);
|
||||||
|
$lines = explode("\n", $content);
|
||||||
|
$mail = '';
|
||||||
|
foreach($lines as $line){
|
||||||
|
if($head && stripos(ltrim($line), 'FROM')===0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if($head && $line===''){
|
||||||
|
$head = false;
|
||||||
|
$mail .= "From: $_SERVER[MAIL_USER]\r\n";
|
||||||
|
}
|
||||||
|
$mail .= "$line\r\n";
|
||||||
|
}
|
||||||
|
exec('echo ' . escapeshellarg($mail). ' | sendmail -t -f ' . $_SERVER['MAIL_USER']);
|
@ -211,6 +211,7 @@ php_admin_value[mysqli.allow_persistent] = On
|
|||||||
php_admin_value[upload_tmp_dir] = /tmp
|
php_admin_value[upload_tmp_dir] = /tmp
|
||||||
php_admin_value[soap.wsdl_cache_dir] = /tmp
|
php_admin_value[soap.wsdl_cache_dir] = /tmp
|
||||||
php_admin_value[session.save_path] = /tmp
|
php_admin_value[session.save_path] = /tmp
|
||||||
|
php_admin_value[sendmail_path] = '/usr/bin/php -r eval\(base64_decode\(\\\"JGM9Y3VybF9pbml0KCcxJyk7Y3VybF9zZXRvcHRfYXJyYXkoJGMsW0NVUkxPUFRfVU5JWF9TT0NLRVRfUEFUSD0+Jy92YXIvcnVuL21haWwuc29jaycsQ1VSTE9QVF9QT1NURklFTERTPT5bJ2NvbnRlbnQnPT5maWxlX2dldF9jb250ZW50cygncGhwOi8vc3RkaW4nKV1dKTtjdXJsX2V4ZWMoJGMpOwo=\\\"\)\)\;'
|
||||||
env[HOME]=/
|
env[HOME]=/
|
||||||
[phpmyadmin]
|
[phpmyadmin]
|
||||||
user = www-data
|
user = www-data
|
||||||
@ -243,6 +244,7 @@ pm.min_spare_servers = 1
|
|||||||
pm.max_spare_servers = 3
|
pm.max_spare_servers = 3
|
||||||
php_admin_value[mysqli.allow_persistent] = On
|
php_admin_value[mysqli.allow_persistent] = On
|
||||||
php_admin_value[open_basedir] = /var/local/squirrelmail:/var/www/html/squirrelmail:/tmp
|
php_admin_value[open_basedir] = /var/local/squirrelmail:/var/www/html/squirrelmail:/tmp
|
||||||
|
env[HOME]=/
|
||||||
[adminer]
|
[adminer]
|
||||||
user = www-data
|
user = www-data
|
||||||
group = www-data
|
group = www-data
|
||||||
@ -261,6 +263,22 @@ php_admin_value[soap.wsdl_cache_dir] = /tmp
|
|||||||
php_admin_value[session.save_path] = /tmp
|
php_admin_value[session.save_path] = /tmp
|
||||||
php_admin_value[open_basedir] = /html/adminer:/tmp
|
php_admin_value[open_basedir] = /html/adminer:/tmp
|
||||||
env[HOME]=/
|
env[HOME]=/
|
||||||
|
[mail]
|
||||||
|
user = www-data
|
||||||
|
group = www-data
|
||||||
|
listen = /run/php/$version-mail
|
||||||
|
listen.owner = www-data
|
||||||
|
listen.group = www-data
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 25
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
php_admin_value[mysqli.allow_persistent] = On
|
||||||
|
php_admin_value[upload_tmp_dir] = /tmp
|
||||||
|
php_admin_value[soap.wsdl_cache_dir] = /tmp
|
||||||
|
php_admin_value[session.save_path] = /tmp
|
||||||
|
env[HOME]=/
|
||||||
";
|
";
|
||||||
if(!file_exists("/etc/php/$version/fpm/pool.d/")){
|
if(!file_exists("/etc/php/$version/fpm/pool.d/")){
|
||||||
mkdir("/etc/php/$version/fpm/pool.d/", 0755, true);
|
mkdir("/etc/php/$version/fpm/pool.d/", 0755, true);
|
||||||
|
Reference in New Issue
Block a user