srv 150521


apt install openssh-server
ip a / if config (net-tools)
dmesg
hostname -f
------------------------------- /etc/hosts
/etc/hostname
-------------------------------
repos
nano /etc/apt/sources.list
strech/buster
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free
-----------------------------
dpkg-reconfigure dash
ls -la .bin/sh
-------------------------
apt-get install ntp
timedatectl status
--------------------------
apt-get install postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd sudo

mysql_secure_installation

Change the root password? [Y/n] YNew password: Geben Sie ein sicheres MariaDB/MySQL Passwort einRe-enter new password: Wiederholen Sie Ihr PasswortRemove anonymous users? [Y/n] YDisallow root login remotely? [Y/n] YRemove test database and access to it? [Y/n] YReload privilege tables now? [Y/n] Y

nano/etc/postfix/master.cf
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject

smtps inet n - - - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
service postfix restart
---
nano /etc/mysql/mariadb.conf.d/50-server.cnf
#bind address
sql-mode="NO_ENGINE_SUBSTITUTION"

echo "update mysql.user set plugin = 'mysql_native_password' where user='root';" | mysql -u root

nano /etc/mysql/debian.cnf
Fügen Sie Ihr MariaDB/MySQL Passwort an der passenden Stelle hinzu und starten mysql neu.
service mysql restart
netstat -tap | grep mysql
---
nano /etc/security/limits.conf
mysql TAB TAB soft TAB nofile TAB 65535
mysql hard nofile 65535

mkdir -p /etc/systemd/system/mysql.service.d
nano /etc/systemd/system/mysql.service

nano /etc/systemd/system/mysql.service.d/limits.conf
[Service]
LimitNOFILE=infinity

systemctl daemon-reload
systemctl restart mariadb
--------------------------
apt install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perllibdbd-mysql-perl postgrey

service spamassassin stop
systemctl disable spamassassin
----------------------------------------


corrected


smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
# -o smtpd_tls_auth_only=yes
# -o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject


======================================================================

9. Spam und Mailfilter

apt-get install amavisd-new spamassassin clamav clamav-daemon unzip bzip2 arj nomarch lzop cabextract p7zip p7zip-full unrar lrzip apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl postgrey

======================================================================
======================================================================
websrv

apt -y install apache2 apache2-doc apache2-utils libapache2-mod-php php7.3 php7.3-common php7.3-gd php7.3-mysql php7.3-imap php7.3-cli php7.3-cgi libapache2-mod-fcgid apache2-suexec-pristine php-pear mcrypt imagemagick libruby libapache2-mod-python php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl memcached php-memcache php-imagick php-gettext php7.3-zip php7.3-mbstring memcached libapache2-mod-passenger php7.3-soap php7.3-fpm php7.3-opcache php-apcu


Apache Module Aktivieren:
a2enmod suexec rewrite ssl actions include dav_fs dav auth_digest cgi headers actions proxy_fcgi alias

Editieren der /etc/apache2/conf-available/httpoxy.conf

RequestHeader unset Proxy early


a2enconf httpoxy
systemctl restart apache2

-------------------------------------------------

Let's Encrypt - SSL

apt-get install certbot

systemctl restart apache2

--
cd /usr/local/bin

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto --install-only
deprecated https://certbot.eff.org/

------------------------------------

apt install mailman
newlist mailman
nano /etc/aliases

paste:

## mailman mailing list
mailman: "|/var/lib/mailman/mail/mailman post mailman"
mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman"
mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman"
mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman"
mailman-join: "|/var/lib/mailman/mail/mailman join mailman"
mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman"
mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman"
mailman-request: "|/var/lib/mailman/mail/mailman request mailman"
mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
Kopieren und Einfügen von der Augabe der Ausgabe newlist mailman

newaliases
service postfix restart

ln -s /etc/mailman/apache.conf /etc/apache2/conf-enabled/mailman.conf

service apache2 restart
service mailman start
===================================================
FTP

apt install pure-ftpd-common pure-ftpd-mysql quota quotatool



nano /etc/default/pure-ftpd-common
Edit:
STANDALONE_OR_INETD=standalone
VIRTUALCHROOT=true

echo 1 > /etc/pure-ftpd/conf/TLS
mkdir -p /etc/ssl/private/

openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

openssl dhparam -out /etc/ssl/private/pure-ftpd-dhparams.pem 2048

chmod 600 /etc/ssl/private/pure-ftpd.pem
service pure-ftpd-mysql restart
---
#quota

nano /etc/fstab
paste ",usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0" after ro

"errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0"

mount -o remount /

quotacheck -avugm (2times)
quotaon -avug

apt install ftp

ftp localhost

---------------------------------------------------------------------

Webalizer Statistiken
apt-get install webalizer awstats geoip-database libclass-dbi-mysql-perl libtimedate-perl

nano /etc/cron.d/awstats

Und alles auskommentieren in dieser Datei (mit einem # davor)
#MAILTO=root
#*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh
#10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh

====================================================================

#Jailkit für chroot

apt install build-essential autoconf automake libtool flex bison debhelper binutils

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.21.tar.gz
tar xvfz jailkit-2.21.tar.gz
cd jailkit-2.21
echo 5 > debian/compat
./debian/rules binary
cd ..
dpkg -i jailkit_2.21*.deb
rm -rf jailkit-2.21*

=====================================================================

#Firewall UFW und Fail2ban
apt install fail2ban ufw


nano /etc/fail2ban/jail.local

Hinzufügen in die Datei:
[pure-ftpd]
enabled = true
port = ftp
filter = pure-ftpd
logpath = /var/log/syslog
maxretry = 5

[dovecot]
enabled = true
filter = dovecot
logpath = /var/log/mail.log
maxretry = 6

[postfix-sasl]
enabled = true
port = smtp
filter = postfix-sasl
logpath = /var/log/mail.log
maxretry = 5
---

##more congiguration folders: /etc/fail2ban/filter.d

service fail2ban restart

---------

ufw congig

file /etc/ufw/before.rules with new version

/etc/ufw/before6.rules with new version

/etc/ufw/after.rules with new version

======================================================================

Manuellen Installation von PHPMyAdmin in Debian 10.x

cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/5.0.4/phpMyAdmin-5.0.4-all-languages.zip

unzip phpMyAdmin-5.0.4-all-languages.zip

mkdir /usr/share/phpmyadmin
mkdir /etc/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp
chown -R www-data:www-data /var/lib/phpmyadmin
touch /etc/phpmyadmin/htpasswd.setup
mv /tmp/phpMyAdmin-5.0.4-all-languages/* /usr/share/phpmyadmin
ls /usr/share/phpmyadmin
/tmp/ rm -rf phpMyAdmin-5.0.4-all-languages*
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

nano /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = '32 ZNAKI'; /* YOU MUST FILL IN THIS FOR COO
dodać $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

nano /etc/apache2/conf-available/phpmyadmin.conf

##paste:

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin


Options FollowSymLinks
DirectoryIndex index.php


AddType application/x-httpd-php .php

php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .




# Authorize for setup


AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup

Require valid-user


# Disallow web access to directories that don't need it

Order Deny,Allow
Deny from All


Order Deny,Allow
Deny from All

----
a2enconf phpmyadmin
systemctl reload apache2
----
mysql -uroot -p
create database phpmyadmin;
create user 'pma'@'localhost' IDENTIFIED BY 'mypassword';
grant all privileges on phpmyadmin.* TO 'pma'@'localhost' identified by 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
----
mysql -u root -p phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
nano /usr/share/phpmyadmin/config.inc.php

$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'mypassword';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
---
http://192.168.1.x/phpmyadmin

------------------------------------
##Roundcube
apt install roundcube roundcube-core roundcube-mysql roundcube-plugins

nano /etc/roundcube/config.inc.php
$config['default_host'] = 'localhost';
$config['smtp_server'] = 'localhost';
--

/etc/apache2/conf-enabled/roundcube.conf
#Hinzufügen der Zeile bei den Aliases:
Alias /webmail /var/lib/roundcube

service apache2 reload

http://192.168.1.x/webmail

=======================================================================

ISPconfig

tmp/
wget https://ispconfig.org/downloads/ISPConfig-3.2.2.tar.gz
cd ispconfig3_install/install/

php -q install.php



---
192.168.1.X:8080
Username: admin
Password: admin


https://phoenixnap.com/kb/ssh-to-connect-to-remote-server-linux-or-windows
https://help.ubuntu.com/community/ServersBehindNAT
.
. .