Disallow .onion as clearnet domain

This commit is contained in:
Daniel Winzen
2019-04-23 20:04:08 +02:00
parent 47c9490c8b
commit 270d025e43

View File

@ -10,7 +10,7 @@ const CAPTCHA=0; // Captcha difficulty (0=off, 1=simple, 2=moderate, 3=extreme)
const ADDRESS='dhosting4xxoydyaivckq7tsmtgi4wfs3flpeyitekkmqwu4v4r46syd.onion'; // our own address const ADDRESS='dhosting4xxoydyaivckq7tsmtgi4wfs3flpeyitekkmqwu4v4r46syd.onion'; // our own address
const SERVERS=[ //servers and ports we are running on const SERVERS=[ //servers and ports we are running on
'dhosting4xxoydyaivckq7tsmtgi4wfs3flpeyitekkmqwu4v4r46syd.onion'=>['sftp'=>22, 'ftp'=>21, 'pop3'=>'110', 'imap'=>'143', 'smtp'=>'25'], 'dhosting4xxoydyaivckq7tsmtgi4wfs3flpeyitekkmqwu4v4r46syd.onion'=>['sftp'=>22, 'ftp'=>21, 'pop3'=>'110', 'imap'=>'143', 'smtp'=>'25'],
'hosting.danwin1210.me'=>['sftp'=>222, 'ftp'=>21, 'pop3'=>'1995', 'imap'=>'1993', 'smtp'=>'1465'] 'hosting.danwin1210.me'=>['sftp'=>22, 'ftp'=>21, 'pop3'=>'1995', 'imap'=>'1993', 'smtp'=>'1465']
]; ];
const EMAIL_TO=''; //Send email notifications about new registrations to this address const EMAIL_TO=''; //Send email notifications about new registrations to this address
const INDEX_MD5S=[ //MD5 sums of index.hosting.html files that should be considdered as unchanged for deletion const INDEX_MD5S=[ //MD5 sums of index.hosting.html files that should be considdered as unchanged for deletion
@ -79,6 +79,7 @@ server {
} }
} }
location /phpmyadmin { location /phpmyadmin {
root /usr/share;
location ~ \.php$ { location ~ \.php$ {
include snippets/fastcgi-php.conf; include snippets/fastcgi-php.conf;
fastcgi_param DOCUMENT_ROOT /html; fastcgi_param DOCUMENT_ROOT /html;
@ -576,7 +577,10 @@ function del_user_onion(PDO $db, int $user_id, string $onion) {
function add_user_domain(PDO $db, int $user_id, string $domain) : string { function add_user_domain(PDO $db, int $user_id, string $domain) : string {
$domain = strtolower($domain); $domain = strtolower($domain);
if(strlen($domain) > 255){ if(strlen($domain) > 255){
return 'Domain can\'t be longer than 255 characters'; return "Domain can't be longer than 255 characters.";
}
if(preg_match('/.onion$/', $domain)){
return "Domain can't end in .onion which is reserved for tor hidden services.";
} }
$parts = explode('.', $domain); $parts = explode('.', $domain);
if(count($parts) < 2){ if(count($parts) < 2){