Categories
VPS

Mail Server Management

And Pharaoh.

Improve the successfull mail delivery rate from the server:

  • set up for the domain names: SPF, DKIM, DMARC
  • Make sure the server hostname appear at the A record, rDNS, server control panel, MTA (includes mailname), and content filter configuration values

As you probably have noticed- the first documented use of an organized courier service for the dissemination of written documents is in Egypt, where Pharaohs used couriers for the dissemination of their decrees in the territory of the State.

Categories
VPS

Web Server Security

And Toy Story.

  • Update frequently
  • Replace passwords frequently while verifying at least 8 characters long (lower and upper case alphabets, numbers and symbols) and set up Two-Factor Authentication
  • Verify that there is a firewall and DDOS protection
  • Config the Intrusion Prevention System (enable mod_remoteip if used with reverse proxy)
  • Set up hiding of the web server details
  • Scan the server files and pass on the logs frequently
  • Use the user root only if required

Disallow SSH root connection, in /etc/ssh/sshd_config use the directive:

PermitRootLogin no

Define which logs will be saved and where in the file /etc/rsyslog.conf.

Config the intrusion prevention system Fail2ban:

  • Activate mod_remoteip (in case of reverse proxy)
  • Create the /etc/fail2ban/jail.local file and use the commands, for example to enable the recidive SSH protection:
[recidive]
enabled = true

[sshd]
enabled = true

Config multiple log files:

logpath = /var/www/clients/client12/web*/log/access.log
          /var/www/clients/client13/web*/log/access.log

Unban IP with the command:

fail2ban-client set sshd unbanip $IP

Hide the Apache web server details- add the directives into /etc/apache2/apache2.conf:

ServerTokens Prod
ServerSignature Off

Hide the PHP details- add the directives into php.ini:

expose_php = off

As you probably have noticed- Buster, Strech, Jessie, and all other Debian distribution code names, are names of characters from the Toy Story movie, inspired by Bruce Ferns who worked at Pixar besides his tenure as the Debian project leader.

Categories
VPS

Proxmox

And the Japanese Car.

Proxmox Virtual Environment (PVE) is an open source server virtualization environment based on Debian. It allows VMs and LXCs, software-defined storage and networking, and high-availability clustering.

Backup the configuration of the server itslef use the command:

tar -zcvf /var/lib/vz/dump/srv_etc_root-$(date +"%Y_%m_%d-%H_%M_%S").tar.gz /etc /root

Disable the option of removal/restoration of LXC, enable the Protection option. Allow users to make backups grant them the permission PVEDatastoreUser on the storage path and PVEVMUser on the VM path.

Limit the number of the saved backups created automatically- use the Max Backups option (Datacenter => Storage).

Use NAT within PVE- create a Linux bridge with the LAN IP, and adjust the build-in firewall to work with the VMs/LXCs- add the directives to /etc/network/interfaces file:

post-up   iptables -t raw -I PREROUTING  -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING  -i fwbr+ -j CT --zone 1

Config NAT and port forwarding with iptables- use in /etc/network/interfaces the directives:

post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '$LAN-IP-SUBNET' -o eno1 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '$LAN-IP-SUBNET' -o eno1 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i eno1 -p tcp -m multiport --dports $PORTS -j DNAT --to $DESTINATION-LAN-IP
post-down iptables -t nat -D PREROUTING -i eno1 -p tcp -m multiport --dports $PORTS -j D

To receive Let’s Encrypt SSL certificate for multiple servers reside behind NAT, set up port forwarding for port 80 to the relevant server during the validation process.

Config new storage in Server => Storage and Datacenter => Storage.

As you probably have noticed- the word Proxmox has no meaning, it was chosen following a short catchy domain name that was available, in order to be on the safe side and not end up like the Japanese automobile manufacturer Nissan, which still struggling to achieve the nissan.com address.

Categories
VPS

ISPConfig

And The Pied Piper.

ISPConfig is an open source hosting control panel for Linux, it allows multiple server management from one control panel includes web server management, mail server management, and DNS server management.

Comply with strict privacy policy websites- disable the web statistics program.

Create users- it is required to set permanent customer no., create resources for him with the feature “login as client”.

Change the server configuration use the path /usr/local/ispconfig/server/conf-custom/ and for the inteface configuration /usr/local/ispconfig/interface/lib/config.inc.local.php.

Activate SSL for a website- first enable the SSL and than the Let’s Encrypt SSL, you may use the Rewrite HTTP to HTTPS and SEO Redirect (domain.tld => www.domain.tld, after creating automatic www subdomain) options. Clean old SSL certificates- use the command (newer certificates will have higher suffix number):

certbot delete

Run WordPress website with SSL in reverse proxy- add the directive to wp-config.php:

$_SERVER['HTTPS'] = 'on';

Use ISPConfig behind NAT– enable the Skip Lets Encrypt Check option (System => Server Config => Web => SSL Settings), use the WAN IP in DNS Settings and Website Settings, and the LAN IP in Server Config and Server IP Addresses.

Config a reverse proxy in Apache web server, which keeps the original reciever address and don’t pass the SSL certificates requests use those directives:

ProxyPreserveHost On
ProxyPass /.well-known/acme-challenge !
ProxyPass /$PATH http://$LAN-IP:$PORT/$PATH
ProxyPassReverse /$PATH http://$LAN-IP:$PORT/$PATH
ProxyPass / http://$LAN-IP:$PORT/
ProxyPassReverse / http://$LAN-IP:$PORT/ 

Recover better- enable rescue option (Server Config tab).

Restore a website from a server backup- it is possible to export and import the website files & database backup and the relevant backup record from the ISPConfig database, to manual run all the configured backups use the command:

php /usr/local/ispconfig/server/cron_debug.php --cronjob=500-backup.inc.php

Enhance the email policy- edit the directives in /etc/postfix/main.cf:

smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_unauth_destination, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_rbl_client cbl.abuseat.org,reject_rbl_client dul.dnsbl.sorbs.net,reject_rbl_client ix.dnsbl.manitu.net, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_client_hostname, check_client_access mysql:/etc/postfix/mysql-virtual_client.cf

Use PureFTP in passive mode (allows using behind firewall)- use the commands (and open the same ports at the firewall):

echo "30510 30610" > /etc/pure-ftpd/conf/PassivePortRange
service pure-ftpd-mysql restart

Deal with a CSRF block while deleting resources- delete it directly in the database.

As you probably have noticed- the oldest written accounts of the Pied Piper of Hamelin was created in Lüneburg, the same town the ISPConfig software is developed.

Categories
VPS

Two-Factor Authentication

And Kim Dotcom.

TOTP-based Two-Factor Authentication makes it difficult for unauthorized access to your account, becuase that besides your password, it will required to obtain the code generated in your app in real time and log in immediately (the code changes every short time) or to locate your secret.

In this verification process, a one-time code is created using an algorithm that uses your secret code and the current time, so that each code is set to change over time.

Two-Factor Authentication is part of the information security system required in every business. To use this authentication method it is required to download an OTP app.

To config TOTP as a second factor to WordPress:

  • Install and activate the plugin
  • Scan the QR code through the app
  • Click update profile

To config TOTP as a second factor to the Roundcube webmail:

  • Install and activate the plugin
  • Enable the option via the setting tab

To config TOTP as a second factor to the phpMyAdmin:

  • Install and activate the feature
  • Enable the option via the setting tab

To config TOTP as a second factor to the VPS SSH:

  • Install libpam-google-authenticator
  • Config google-authenticator
  • In /etc/pam.d/sshd file comment @include common-auth and add auth required pam_google_authenticator.so
  • In /etc/ssh/sshd_config file change ChallengeResponseAuthentication value to yes, PasswordAuthentication value to no, and add AuthenticationMethods publickey,keyboard-interactive
  • Restart the SSH service

To config TOTP as a second factor to the VPS Control Panel:

  • Press the TFA button in the user list
  • Randomize the secret key (optional)
  • Set the Issuer Name (optional)
  • Scan the QR code through the app
  • Enter your password
  • Enter the TOTP Value the app generated
  • Press Apply

As you probably have noticed- Kim Dotcom threatened to sue all the major web services offering this kind of authentication, bases on its patent from 2000. Currently the European Patent Office revoked his patent in light of an earlier 1998 US patent held by AT&T.