mirror of
https://github.com/DanWin/mail-hosting.git
synced 2024-09-07 19:11:11 +00:00
Add primary domain in setup.php
This commit is contained in:
parent
f197f10228
commit
bef733240f
|
@ -160,6 +160,8 @@ nano /var/www/mail/tools/create_admin.php
|
|||
php /var/www/mail/tools/create_admin.php
|
||||
```
|
||||
|
||||
Copy the file `/etc/postfix/danwin1210-mail.crt` from your main server to the same location on the proxy server.
|
||||
|
||||
Final step is to reboot the server and check that everything is working.
|
||||
|
||||
### General Domain settings
|
||||
|
|
|
@ -27,7 +27,6 @@ const DBUSER_PROSODY = 'prosody'; // Database user
|
|||
const DBPASS_PROSODY = 'YOUR_PASSWORD'; // Database password
|
||||
const DBNAME_PROSODY = 'prosody'; // Database
|
||||
const REGISTRATION_ENABLED = true; // Whether registration is enabled
|
||||
const PRIMARY_DOMAIN='danwin1210.de'; // Primary domain to use when a username without domain part was specified
|
||||
|
||||
const LANGUAGES = [
|
||||
'cs' => ['name' => 'čeština', 'locale' => 'cs_CZ', 'flag' => '🇨🇿', 'show_in_menu' => true, 'dir' => 'ltr'],
|
||||
|
|
|
@ -36,7 +36,7 @@ ip6tables -A OUTPUT -o lo -j ACCEPT
|
|||
iptables -A INPUT -i lo -j ACCEPT
|
||||
ip6tables -A INPUT -i lo -j ACCEPT
|
||||
#unrestricted access to these IPs
|
||||
for clearnet in 127.0.0.0/8; do(
|
||||
for clearnet in 127.0.0.0/8 10.9.0.0/24; do(
|
||||
iptables -t nat -A OUTPUT -d $clearnet -j RETURN
|
||||
iptables -A OUTPUT -d $clearnet -j ACCEPT
|
||||
) done
|
||||
|
|
10
setup.php
10
setup.php
|
@ -60,3 +60,13 @@ try{
|
|||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
}
|
||||
try {
|
||||
$stmt = $db->prepare( 'INSERT IGNORE INTO domain (domain, created, modified) VALUES (?, NOW(), NOW())' );
|
||||
$stmt->execute( [ CLEARNET_SERVER ] );
|
||||
$stmt->execute( [ ONION_SERVER ] );
|
||||
$stmt = $db->prepare( 'INSERT IGNORE INTO alias_domain (alias_domain, target_domain, created, modified) VALUES (?, ?, NOW(), NOW())' );
|
||||
$stmt->execute( [ ONION_SERVER, CLEARNET_SERVER ] );
|
||||
} catch( PDOException $e ) {
|
||||
echo _('Error adding primary domain:') . PHP_EOL;
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
|
|
@ -7,5 +7,3 @@ $db = get_db_instance();
|
|||
$hash = password_hash( ADMIN_PASS, PASSWORD_ARGON2ID );
|
||||
$stmt = $db->prepare( 'INSERT INTO admin (password_hash_type, password, superadmin, username, created, modified) VALUES ("{ARGON2ID}", ?, 1, ?, NOW(), NOW());' );
|
||||
$stmt->execute( [ $hash, ADMIN_USER ] );
|
||||
$stmt = $db->prepare( 'INSERT IGNORE INTO domain (domain, created, modified) VALUES (?, NOW(), NOW())' );
|
||||
$stmt->execute( [ PRIMARY_DOMAIN ] );
|
|
@ -49,7 +49,7 @@ if ( $_SERVER[ 'REQUEST_METHOD' ] === 'POST' ) {
|
|||
if ( $ok ) {
|
||||
$db = get_db_instance();
|
||||
$user = $match[ 1 ];
|
||||
$domain = $match[ 3 ] ?? PRIMARY_DOMAIN;
|
||||
$domain = $match[ 3 ] ?? CLEARNET_SERVER;
|
||||
$stmt = $db->prepare( 'SELECT target_domain FROM alias_domain WHERE alias_domain = ? AND active=1;' );
|
||||
$stmt->execute( [ $domain ] );
|
||||
if ( $tmp = $stmt->fetch( PDO::FETCH_ASSOC ) ) {
|
||||
|
|
|
@ -31,7 +31,7 @@ if ( isset( $_POST[ 'user' ] ) ) {
|
|||
$msg .= '<div class="red" role="alert">'.htmlspecialchars(_('Invalid username. It may not contain a +, \', " or /.')).'</div>';
|
||||
}
|
||||
$user = mb_strtolower( $match[ 1 ] ?? '' );
|
||||
$domain = $match[ 3 ] ?? PRIMARY_DOMAIN;
|
||||
$domain = $match[ 3 ] ?? CLEARNET_SERVER;
|
||||
if ( $ok && ( empty( $_POST[ 'pwd' ] ) || empty( $_POST[ 'pwd2' ] ) || $_POST[ 'pwd' ] !== $_POST[ 'pwd2' ] ) ) {
|
||||
$ok = false;
|
||||
$msg .= '<div class="red" role="alert">'.htmlspecialchars(_('Passwords empty or don\'t match')).'</div>';
|
||||
|
|
Loading…
Reference in a new issue