pip

pip list --format=freeze --not-required > requirements.in
pip install pip-tools
pip-compile requirements.in        # generates a fully pinned requirements.txt

 

 

Tags

vim ~/.zshrc

# ~/.zshrc

# Env setup
export ZSH="$HOME/.oh-my-zsh"

# SSH agent setup (before plugin load)
zstyle :omz:plugins:ssh-agent identities ~/.ssh/id_ed25519
zstyle :omz:plugins:ssh-agent lazy yes
zstyle :omz:plugins:ssh-agent lifetime 4h

# Oh My Zsh config
ZSH_THEME="robbyrussell"
plugins=(debian common-aliases colored-man-pages git fzf grc zoxide ssh-agent)

# Load Oh My Zsh and extra plugins
source $ZSH/oh-my-zsh.sh
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlig
Tags
  1. ai postgresql
  2. systemctl status postgresql
  3. /etc/postgresql/15/main/pg_hba.conf

psql

  1. LANG=C
  2. psql -U postgres -c "SELECT datname FROM pg_catalog.pg_database;"
  3. psql -U postgres -c "DROP DATABASE DBNAME;"
  4. psql -U postgres -c "SELECT * FROM pg_catalog.pg_user;"

📦 Gitea Pull & Push Workflow

⚡ Schnellstart

mkdir -p ~/scripts && \
curl -L https://gitea.bubuit.net/oib/at2-workstation-scripts/raw/branch/main/gitea_push.sh \
  -o ~/scripts/gitea_push.sh && \
chmod +x ~/scripts/gitea_push.sh && \
echo "[INFO] gitea_push.sh ready in ~/scripts"

➡️ Lädt die aktuelle Version direkt von Gitea, macht sie ausführbar und gibt eine Info aus.

Tags
  1. cat /etc/apt/preferences; cat /etc/apt/preferences.d/*
  2. apt-cache policy
  3. ai apt-listchanges deborphan
for pkg in $(deborphan); do
   aptitude why "$pkg"
done
  1. apt remove --purge $(deborphan)
  2. apt list --installed
  3. apt-mark showhold
Tags

Das Kommandozeilenwerkzeug install ist Bestandteil der GNU Coreutils und wurde speziell für das Installieren von Programmen, Skripten und Dateien entwickelt. Es vereint die Funktionen von cp, mkdir, chmod und chown in einem einzigen, leistungsstarken Befehl. Dies vereinfacht viele typische Aufgaben bei der Softwarebereitstellung.

  1. vim /etc/bind/named.conf.options
  2. vim /etc/bind/named.conf.local
  3. mkdir /var/log/named/
  4. chown -R bind:bind /var/log/named/
  5. sc-restart named.service
  6. t /var/log/named/*

🛍 DNS-Referenz-Setup (ns1.dynproxy.net – 23.88.113.138)

🔐 Rollenverteilung

  • Autoritativer DNS-Server für:
    • dynproxy.net
    • bubuit.net
  • Lokaler Resolver für:
    • 127.0.0.1

📜 Wichtige Konfigurationsregeln

Tags
  1. ssh -Q kex
  2. ssh -G USER@HOST G ^kexalgorithms
  3. ssh -v USER@HOST #debug1: kex

vim /etc/ssh/sshd_config

AllowUsers *@123.456.789.* USER@IP

KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256
Tags

~/.ssh/config

Host ALIAS
 HostName HOST.DOM.TLD
 User USER
 
# client_loop: send disconnect: Broken pipe # NAT/Firewall Termination
Host *
 TCPKeepAlive yes
 ServerAliveInterval 30
 ServerAliveCountMax 5

init

  1. ssh-keygen -t ed25519
  2. cat ~/.ssh/id_ed25519.pub
  3. ssh-copy-id -i $HOME/.ssh/id_ed25519.pub root@bubu
  4. echo "id_ed25519 ...
Tags

Overview

  • User backup is used for secure remote backups via SFTP only.
  • Access is restricted to a chroot jail.
  • No shell access is allowed.

Login Details

  • Host: dioxi.ddns.net
  • Port: 22
  • Username: backup
  • Protocol: SFTP
  • Remote directory after login: /data

Directory Structure

  • /mnt/data/backup → chroot jail (owned by root)
  • /mnt/data/backup/data
Tags
  1. ai autopostgresqlbackup
  2. dpkg -L autopostgresqlbackup
  3. mkdir /var/backups/autopostgresqlbackup
  4. vim /etc/default/autopostgresqlbackup
  5. /usr/sbin/autopostgresqlbackup
  6. l /var/backups/autopostgresqlbackup/*/*

PeerTube

  1. https://docs.joinpeertube.org/maintain/migration 
  2. vim $(which autopostgresqlbackup) +361 #367
    • su $SU_USERNAME -l -c "pg_dump -Fc $PGHOST $OPT $db -f $2"
    • pg_dump -Fc --username=$USERNAME $PGHOST $OPT $db -f $2
  1. vim /etc/cron.daily/lxc-update-template
  2. chmod +x /etc/cron.daily/lxc-update-template
#!/bin/bash
# =============================================================================
# Script Name: update_lxc_template.sh
# Version: 1.0
# Description: Starts the 'template' LXC container, performs an update &
#              upgrade inside it, and shuts it back down after.
# =============================================================================

CONTAINER="template"

echo "[DEBUG] Starting $CONTAINER..."
lxc-start -n "$CONTAINER"
Tags
  1. ai firehol firehol-tools ulogd2
  2. sc-status firehol
  3. sc-start firehol
  4. sc-restart firehol

vim /etc/default/firehol

START_FIREHOL=YES

vim /etc/firehol/firehol-defaults.conf +461

  • t /var/log/ulog/syslogemu.log
# IPTABLES PACKETS LOGGING
# LOG mode for iptables
# Default: LOG
# Possible Values: LOG, ULOG, NFLOG
# LOG = syslog
# We recommend to install ulogd and use NFLOG.
FIREHOL_LOG_MODE="NFLOG"

vim /etc/

Tags
  1. https://web-docs.element.dev/Element%20Web/index.html 
  2. wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
  3. wget -O /usr/share/keyrings/element-io-archive-keyring.gpg https://packages.element.io/debian/element-io-archive-keyring.gpg
  4. echo "deb [signed-by=/usr/shar
Tags
Tags
  1. https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart 
  2. firehol.conf: dnat4 to 10.0.3.IP inface "${wan}" proto udp dport 10000
  3. ai gnupg2 nginx-full
  4. curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg' 
  5. echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg]

Problemstellung

E-Mails, die von lists.bubuit.net gesendet wurden, wurden von Gmail und anderen Mailservern mit folgendem Fehler abgelehnt:

Tags

vim /etc/vim/vimrc

syntax on                  " Enable syntax highlighting
set background=dark        " Optimize color schemes for a dark background
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal!
Tags
#!/bin/bash
# Script Version: 0.10
# Description: Check if Postfix is installed before proceeding with installation

# Validate hostname before proceeding
if [ "$(hostname)" == "$(hostname --fqdn)" ]; then
    echo "Error: Hostname and fully qualified domain name must differ."
    exit 1
fi

# Variables
# ========
POSTFIX_MAIN_CF=/etc/postfix/main.cf
SASL_PASSWD_FILE=/etc/postfix/sasl_passwd
SMTP_SERVER="mail.bubuit.net"
SMTP_PORT="587"
SMTP_USER="user"
SMTP_PASS="password"
RECIPIENT="root@mail.box"
TEST_RECIPIENT="root"
MAILNAME=$(hostname --fqdn)
ALIASES
  1. ai ansible
  2. omz plugin enable ansible
  3. omz plugin info ansible

vim ~/scripts/ansible_structure_setup.sh

#!/bin/bash
# Script Version: 0.8
# Description: Set up Ansible directory structure and necessary files in /etc/ansible

# Create directories
mkdir -p /etc/ansible/{group_vars,host_vars,roles,playbooks}

# Create configuration and inventory files
if [ !
Tags

/etc/hosts @lxc-host

127.0.0.1	localhost			localhost.localdomain
PUBLIC-IP	HOSTNAME.DOM.TLD	HOSTNAME
10.0.3.ip	peertube.DOM.TLD	peertube
10.0.3.ip	webradio.DOM.TLD	webradio
10.0.3.ip	jitsi.DOM.TLD		jitsi
10.0.3.ip	lists.DOM.TLD		lists
10.0.3.ip	drupal.DOM.TLD		drupal
10.0.3.ip	owncloud.DOM.TLD	owncloud

/etc/hostname

jitsi
  1. hostname -F /etc/hostname
  2. hostnamectl status
  3. hostnamectl set-hostname jitsi
  4. hostname --fqdn
    • jitsi.bubuit.net
Tags

client

  1. mkdir -p /root/scripts/dynProxy/token
  2. vim /root/scripts/dynProxy/update_zone_client.sh
    edit TOKEN_FILE
  3. chmod +x /root/scripts/dynProxy/update_zone_client.sh
  4. openssl rand -hex 16 > /root/scripts/dynProxy/token/SUBDOM.DOM.TLD
  5. crontab -e
Tags
#!/bin/zsh
# Version 02.9

# Variables
NAMED_CONF_LOCAL="/etc/bind/named.conf.local"
CHECKZONE_CMD="named-checkzone"

# Function to parse zones and file paths
parse_zones() {
    awk '/zone/ {gsub(/[\";]/, ""); zone=$2} /file/ {gsub(/[\";]/, ""); file=$2; print file}' "$NAMED_CONF_LOCAL"
}

# Main function
main() {
    echo "Parsing $NAMED_CONF_LOCAL for zone files"

    parse_zones | while read -r ZONE_FILE; do
        if [ -z "$ZONE_FILE" ]; then
            echo "No file specified for zone"
            continue
        fi

        if [ -f "$ZONE_FILE" ]
Tags
#!/bin/zsh
# Version 01.0
# Script to test DNS zone propagation across ns1, ns2, and ns3
# Script Name: test_ns_zones.sh

# Variables
NS1="23.88.113.138"
NS2="116.202.112.180"
NS3="95.216.198.140"

# Check if a domain name argument is provided
if [ -z "$1" ]; then
	echo "Usage: $0 <domain.tld>"
	exit 1
fi

DOMAIN=$1

# Function to test a DNS query
function test_ns {
	local NS=$1
	echo "
=== Testing $DOMAIN on $NS ==="
	dig @$NS $DOMAIN SOA +short
echo ""
	echo "MX Record:"
	dig @$NS $DOMAIN MX +short
echo ""
	echo "A Record for mail.$DOMAIN:"
	dig @$
Tags
#!/bin/zsh
# Version 01.0
# Script to add a new slave zone to /etc/bind/named.conf.local on ns2.dynproxy.net
# Script Name: bind_add_slave_zone.sh

# Variables
NAMED_CONF="/etc/bind/named.conf.local"
CACHE_DIR="/var/cache/bind"

# Check if a domain name argument is provided
if [ -z "$1" ]; then
	echo "Usage: $0 <domain.tld>"
	exit 1
fi

DOMAIN=$1
ZONE_FILE="$CACHE_DIR/db.$DOMAIN"

# Check if the zone configuration already exists
if grep -q "zone \"$DOMAIN\"" $NAMED_CONF; then
	echo "Zone $DOMAIN already exists in $NAMED_CONF.
Tags
#!/bin/zsh
# Version 01.0
# Script to add a new slave zone to /etc/bind/named.conf.local on ns3.dynproxy.net
# Script Name: bind_add_slave_zone_ns3.sh

# Variables
NAMED_CONF="/etc/bind/named.conf.local"
CACHE_DIR="/var/cache/bind"

# Check if a domain name argument is provided
if [ -z "$1" ]; then
	echo "Usage: $0 <domain.tld>"
	exit 1
fi

DOMAIN=$1
ZONE_FILE="$CACHE_DIR/$DOMAIN.db"

# Check if the zone configuration already exists
if grep -q "zone \"$DOMAIN\"" $NAMED_CONF; then
	echo "Zone $DOMAIN already exists in $NAMED_CONF.
Tags
#!/bin/zsh
# Version 01.0
# Script to add a new zone to /etc/bind/named.conf.local on ns1.dynproxy.net
# Script Name: bind_add_zone.sh

# Variables
NAMED_CONF="/etc/bind/named.conf.local"
ZONES_DIR="/etc/bind/zones"

# Check if a domain name argument is provided
if [ -z "$1" ]; then
	echo "Usage: $0 <domain.tld>"
	exit 1
fi

DOMAIN=$1
ZONE_FILE="$ZONES_DIR/db.$DOMAIN"

# Check if the zone file already exists
if [ -f "$ZONE_FILE" ]; then
	echo "Zone file $ZONE_FILE already exists.
Tags
  1. ai fail2ban
  2. fail2ban-client status
  3. fail2ban-client status postfix
  4. fail2ban-client set postfix unbanip IP
  5. fail2ban-regex /var/log/mail.warn /etc/fail2ban/filter.d/postfix.conf
  6. vim /etc/fail2ban/jail.local
  7. fail2ban-client reload postfix
  8. service fail2ban restart
  9. fail2ban-customs
  10. f2b_status.sh

show my public ip

curl -4 http://ip.dynproxy.net

Tags
acl "trusted" {
       127.0.0.0/8;
       10.0.3.0/24;
       192.168.0.0/24;
};
options {
    directory "/var/cache/bind";
    dnssec-validation no;
   querylog yes;
   auth-nxdomain no;
   notify yes;
   version none;
    listen-on { 127.0.0.1; SRVIP; };
    listen-on-v6 { ::1; SRVIP; };
   
   allow-query { any; };
   allow-query-cache { trusted; };
   recursion yes;
   allow-recursion { trusted; };
   max-cache-size 512M;
};
logging {
   channel default_file {
       file "/var/log/named/defa
Tags

#!/bin/zsh
# Script Version: 12.4
# Description: Dyn DNS update script, checks token and updates DNS zone.

# Set variables
DIRECTORY="/var/www/ip/token"
LOG_FILE="/var/log/dynProxy.log"
TOKEN_DNS_ZONE_FILE="/etc/bind/tokendnszone.conf"
NSUPDATE_SERVER="127.0.0.1"
DEBUG=true

log() {
   local message="$1"
   echo "$(date '+%Y-%m-%dT%H:%M:%S.%6N'): $message" >> "$LOG_FILE"
   if $DEBUG; then echo "$message"; fi
}

log_debug() {
   if $DEBUG; then log "$1"; fi
}

#!/bin/zsh
# Script Version: 10
# Description: Dyn DNS update script, checks token, compares IPs, and updates DNS zone if needed.

# Set variables
# ========
TOKEN_FILE="/root/scripts/dynProxy/token.txt"
IP_FILE="/root/scripts/dynProxy/ip.txt"
UPDATE_URL="http://ip.dynproxy.net/update_zone"
LOG_FILE="/var/log/update_zone.log"

# Functions
# ========
log() {
    print "$(date '+%Y-%m-%dT%H:%M:%S.%6N'): $1" >> "$LOG_FILE"
}

  1. YEAR=$(date +'%Y')
  2. DOMTLD=DOM.TLD
  3. mkdir  /etc/opendkim/keys/$DOMTLD
  4. cd /etc/opendkim/keys/$DOMTLD
  5. opendkim-genkey -s $YEAR -d $DOMTLD
  6. chown opendkim:opendkim *.private
  7. /etc/opendkim.conf

cat /etc/opendkim/keys/$DOMTLD/$YEAR.txt

mail._domainkey    IN    TXT    ( "v=DKIM1; h=sha256; k=rsa; " "p=...

vim /etc/opendkim/SigningTable

#!/bin/bash
# Script Version: 02
# Description: Drops all tables in a specified MySQL database. If only one argument is given, the user and database name will be the same.

# Check arguments
if [ $# -lt 1 ]; then
    echo "Usage: $0 <DB_USER> [DB_NAME]"
    exit 1
fi

# Assign arguments
DB_USER=$1
DB_NAME=${2:-$1} # If no second argument is provided, use the first as the database name.

# Prompt for password
read -sp "Enter MySQL password: " DB_PASS
echo

# Confirmation prompt
read -p "Are you sure you want to drop all tables in $DB_NAME?
Tags

🚫 Keine Vorkenntnisse erforderlich! Wir beginnen ganz von vorne.

🎯 Ziel ist es, zu zeigen, wie sicher und privat kommuniziert wird. Mit Technologien, die selbst kontrolliert werden können.

In dieser Sitzung werde ich die Nutzung dieser Tools mit Euch testen

Tags
#!/bin/zsh
# Script Version: 1.1
# Description: Create MySQL Database and User (same name) with generated password

# Set variables
DBNAME=$1
PASSWORD=""
LOG_FILE="/var/log/mysql_db_user_creation.log"

# Functions
ask_for_input() {
    if [ -z "$DBNAME" ]; then
        read "DBNAME?Enter the database and username: "
    fi
}

generate_password() {
    PASSWORD=$(openssl rand -base64 12)
}

create_db_and_user() {
    echo "Creating MySQL Database and User..."
    mysql -u root -p <<EOF
CREATE DATABASE IF NOT EXISTS \`$DBNAME\`;
CREATE USER IF NOT EXIS
Tags

install

  1. su - drupal
  2. cd /var/www/DRUPALPROJECT
  3. composer require drush/drush:^12 -w
  4. ./vendor/bin/drush --version

vim ~/.zshrc

# Add ./vendor/bin to PATH only if it exists
function update_vendor_bin_path() {
    if [ -d "$PWD/vendor/bin" ]; then
        export PATH="$PWD/vendor/bin:$PATH"
    else
        # Remove ./vendor/bin from PATH if no longer exists
        PATH=$(echo "$PATH" | awk -v
Tags
  1. share history

Tags
  1. apt update
  2. apt install zsh curl wget git vim aptitude
    1. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    2. sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
  3. plugins omz-plugin-info
    1. vim ~/.zshrc
      • omz reload
    2. omz plugin load debian; o
Tags
  1. curl -sS https://getcomposer.org/installer | php 
  2. mv composer.phar /usr/local/bin/composer
  3. composer audit
  4. composer diagnose
  5. composer update --no-plugins --no-scripts -W --ignore-platform-reqs -vvv
  6. composer update

 

Tags
  1. composer apache2 mariadb-server mariadb-client php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc
  2. adduser drupal
  3. usermod -aG www-data drupal

Create New Site

  1. nginx-drupal-proxy 
  2. SITEDOMAIN=
  3. vim /etc/apache2/sites-available/$SITEDOMAIN.conf
  4. a2ensite $SITEDOMAIN.conf
  5. systemctl reload apache2
  6. su drupal
Tags
  1. https://certbot.eff.org/instructions?ws=nginx&os=debianbuster
  2. include snippets/letsencrypt-acme-challenge.conf;
  3. certbot --nginx --expand --redirect  --cert-name bubuit.net -d DOM.TLD,SUBDOM.DOM.TLD
    1. # KEIN ABSTAND KOMMA

 

  1. https://github.com/firehol/firehol/wiki/dnsbl-ipset.sh
  2. /usr/share/doc/firehol-tools/examples/contrib/dnsbl-ipset.sh

/etc/firehol/firehol.conf

ipset4 create dnsbl hash:ip timeout $[86400 * 14] maxelem 500000 prevent_reset_on_restart comment 
action4 AUDIT_ACCEPT \ 
action ACCEPT state NEW log "AUDIT" \ 
next action ACCEPT 
blacklist4 full inface "${wan}" ipset:dnsbl \ 
except src ipset:whitelist

leider waren auch

vim /etc/logrotate.d/rsyslog

vim /etc/logrotate.conf

/etc/cron.daily/awstats

#!/bin/sh
/usr/share/awstats/tools/update.sh && /usr/share/awstats/tools/buildstatic.sh

/etc/logrotate.d/apache2

/var/log/apache2/*.log {
    weekly    
    missingok
    rotate 1
    compress
    delaycompress
    notifempty
    create 640 root adm 
    sharedscripts
 
Tags

Install Necessary Packages on Both Nodes

Begin by installing Incus and its associated tools on both node1 and node2.

  • apt update sudo apt install incus incus-tools

    The incus-tools package includes utilities like lxc-to-incus, which facilitates the migration of LXC containers to Incus.

Tags

1. Listing Available Images To view available Debian images:

  • incus image list images: debian

2. Launching a New Container To create and start a new container named debian13-container on the 16C32T node:

Tags
  1. https://docs.hetzner.com/de/dns-console/dns/general/recursive-name-servers/
  2. https://linuxhint.com/install_dig_debian_9/

vim /etc/dnsmasq.conf

cache-size=10000
# neg-ttl=3600

interface=lxcbr0
bind-interfaces

vim /etc/resolv.conf

nameserver    10.0.3.1

domain bubuit.net
search bubuit.net

nameserver DN
Tags

/etc/postfix/main.cf

myorigin = /etc/mailname
mydestination = FQDN, localhost.localdomain, localhost
relayhost = mail.bubuit.net:587
mynetworks = 127.0.0.0/8 192.168.0.0/24 [::1]/128 [fe80::]/64
mailbox_size_limit = 0
recipient_delimiter = +

inet_interfaces = all 
inet_protocols = all

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

# SASL auth
# smtp_use_tls = yes
# support for parameter "smtp_use_tls" will be removed; instead, specify "smtp_tls_security_level"

smtp_tls_security_level = may
smtp_sasl_auth_enable = yes
smtp_sas
Tags

vim /etc/default/grub

GRUB_GFXMODE=1920x1080
  1. update-grub

LXC

  1. https://wiki.debian.org/LXC
  2. ai lxc bridge-utils dnsmasq
  3. sc-status lxc lxcfs lxc-net
  4. LXCHOSTNAME=template
  5. export MIRROR=http://ftp.de.debian.org/debian
  6. lxc-create -n $LXCHOSTNAME -t debian -- -r bookworm
  7. lxc-start -n $LXCHOSTNAME
  8. lxc-ls -f
  9. lxc-info -n $LXCHOSTNAME -l DEBUG
  10. t /var/log/lxc/$LXCHOSTNAME.log 
  11. lxc-attach -n $LXCHOSTNAME adduser DEINUSER
  12. lxc-attach -n $LXCHOSTNAME adduser DEI
Tags
#!/bin/bash
# Script Name: sendmail_test.sh
# Version: 03
# Description: This script sends a test email using sendmail. The recipient's email address is the first argument.
#              It logs messages to the console only.

# Check if an argument (email address) is provided
if [ -z "$1" ]; then
    TO="root"
else
    TO="$1"
fi

# Email details
SUBJECT="Postfix Test"
FROM="$(whoami)@$(hostname)"
BODY="This is the email body!"

# Function to send email
send_email() {
    if !
  1. ai logcheck syslog-summary
  2. rm /etc/logcheck/logcheck.logfiles.d/syslog.logfiles

vim /etc/logcheck/logcheck.conf

SYSLOGSUMMARY=1
ATTACKSUBJECT="Security Alerts"
SECURITYSUBJECT="Security Events"
EVENTSSUBJECT="System Events"
Tags

/etc/systemd/journald.conf

Storage=auto
SystemMaxUse=1G
MaxRetentionSec=1week
ForwardToSyslog=no
  1. sc-restart systemd-journald
  2. du -sch /var/log/journal
  3. sc-failed
  4. omz plugin info systemd
  5. journalctl -p err -b
     
Tags

/etc/fail2ban/filter.d/spamassassin.conf

[Definition]
failregex = failregex = \[<ADDR>\]: 5\.7\.1 Blocked by SpamAssassin;
ignoreregex =

/etc/fail2ban/filter.d/postfix-custom.conf

# Fail2Ban filter for selected Postfix SMTP rejections
[INCLUDES]
# Read common prefixes.
Tags

/etc/fail2ban/jail.local

[DEFAULT]
ignoreip    = 10.0.3.0/24
bantime        = 1d
findtime    = 2d
maxretry    = 2

[pam-generic]
ignoreip    = YOUR-LOCAL-CLIENT-IP-RANGE.0.0/16 
enabled    = true
filter    = pam-generic 
logpath    = /var/log/auth.log

[sshd]
ignoreip    = YOUR-LOCAL-CLIENT-IP-RANGE.0.0/16 
enabled   &nbsp
Tags

Here’s a concise BIND9 Dynamic Zone Management Cheat Sheet to handle common tasks and troubleshoot dynamic zones:

Tags

Warning: Database is older than source file /etc/aliases

newaliases 
postfix reload

DNS Standards

According to DNS standards (RFC 2181, Section 10.3), MX records should reference a domain name, not an IP address. 
The domain name should then resolve to an IP address via an A or AAAA record.

Tags
/^X-Spam-Level: \*{9,}/    REJECT Spam-Level over 10.
/^To: undisclosed-recipients:/    REJECT Please specify who your sending to.
/^To: Undisclosed recipients:/    REJECT Please specify who your sending to.

/^From:.*\@.*\.cn/      REJECT Sorry, Chinese mail not allowed here
/^From:.*\@.*\.kr/      REJECT Sorry, Korean mail not allowed here
/^From:.*\@.*\.tr/      REJECT Sorry, Turkish mail not allowed here
/^From:.*\@.*\.ru/      REJECT Sorry, Russian mail not allowed here
/^From:.*\@.*\.ro/    
Tags
compatibility_level = 3.6
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
home_mailbox = Maildir/
mail_owner = postfix
myhostname = mail.bubuit.net
mydomain = bubuit.net
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
setgid_group = postdrop
inet_interfaces = all
inet_protocols = ipv4 
unknown_local_rec
Tags
smtp      inet  n       -       y       -       -       smtpd 
submission inet n       -       y       -       -       smtpd
 -o syslog_name=postfix/submission
 -o smtpd_tls_security_level=encrypt
 -o smtpd_sasl_auth_enable=yes
# -o content_filter=spamassassin
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?
Tags

postcat

-b Show body content. 
-h Show message header content. 
-q Search the Postfix queue for the named files instead of taking the names literally.

postsuper

-d MSGID
-d ALL
flush

postqueue

-f

Tags
#!/bin/bash
# =============================================================================
# Script Name: lxc_list_login.sh
# Version: 03
# Description: Lists LXC containers, checks their statuses, and allows login.
# =============================================================================

# Required commands
REQUIRED_CMDS=("lxc-ls" "lxc-info" "lxc-start" "lxc-attach")

# Check if required commands are available
for CMD in "${REQUIRED_CMDS[@]}"; do
    if ! command -v "$CMD" &> /dev/null; then
        echo "The command $CMD is not installed.
Tags
 # These mailboxes are widely used and could perhaps be created automatically:
 mailbox Drafts {
    auto = subscribe
   special_use = \Drafts
 }
 mailbox Important {
    auto = subscribe
   special_use = \Important 
 }
 mailbox Archive {
    auto = subscribe
   special_use = \Archive
 }
Tags

ssl = yes
ssl_cert = </etc/letsencrypt/live/DOM.TLD/fullchain.pem
ssl_key = </etc/letsencrypt/live/DOM.TLD/privkey.pem

 

Tags
#!/bin/zsh
# Script Version: 02
# Description: List available Borg backups in the specified repository

# Set variables
# ========
REPO1="ssh://"
BORG_PASSPHRASE_FILE="/root/.borg_passphrase"

# Functions
# ========
log_message() {
    echo "$(date +"%Y-%m-%d %H:%M:%S") - $1"
}

# Main Process
# ========
log_message "Listing available backups in repository."

# Ensure Borg passphrase file is available
if [ -f "$BORG_PASSPHRASE_FILE" ]; then
    export BORG_PASSPHRASE=$(<"$BORG_PASSPHRASE_FILE")
else
    log_message "Borg passphrase file not found."
    
Tags
  1. https://docs.joinpeertube.org/maintain/tools#peertube-runner 
  2. https://docs.joinpeertube.org/admin/remote-runners 
  3. curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
  4. ai nodejs ffmpeg pipx
  5. npm install -g @peertube/peertube-cli @peertube/peertube-runner
  6. useradd -m -d /srv/prunner -s /bin/bash -p prunner prunner
  7. su prunner
  8. p
Tags
  1. https://wiki.debian.org/DebianSpamAssassin 
  2. ai spamassassin spamass-milter re2c pyzor libmail-spamassassin-perl libarchive-zip-perl libidn2-dev libgeo-ip-perl libgeoip-dev perl-doc cpanminus
  3. cpanm IP::Country::Fast Compress::Zlib Geo::IP Net::LibIDN2 Mail::SpamAssassin Digest::SHA1 Net::LibIDN2 IP::Country::DB_File Encode::Detect::Detector Net::Patricia Net::CIDR::Lite Devel::Cycle Test::More
  4. sa-update
  5. sa-compile
  6. spamassassin --lint -D
  7. /etc/default/spamd
  8. /etc/default/sp

## Blocklists and DNS-Based Rules
# Rules related to blocklists, DNS checks, and relay listings.
score RCVD_IN_SBL_CSS 4.0            # Listed in Spamhaus SBL-CSS blocklist
score URIBL_DBL_PHISH 3.5            # Phishing URL in Spamhaus DBL
score RCVD_IN_VALIDITY_RPBL 2.0      # Relay in Validity RPBL
score URIBL_BLOCKED 1.5              # Blocked URI query

Tags
  1. https://serverfault.com/questions/899364/netdata-ipv4-udp-errors
  2. ai netdata
  3. echo "[global]" > /var/lib/netdata/cloud.d/cloud.conf
    echo "enabled = no" >> /var/lib/netdata/cloud.d/cloud.conf
  4. chown netdata:netdata /var/lib/netdata/cloud.d/cloud.conf
Tags
  1. ssh-keygen -f "/home/YOUR-USER/.ssh/known_hosts" -R "YOUR-IPADRESS"

dedicated-server

  1. https://docs.hetzner.com/robot/dedicated-server/troubleshooting/hetzner-rescue-system/ 
  2. ssh root@IP
  3. mount /dev/md2 /mnt
  4. mount /dev/md1 /mnt/boot
  5. chroot-prepare /mnt
  6. mount -t devpts devpts /mnt/dev/pts
  7. chroot /mnt
  8. zsh

 

Tags

SPF

ai postfix-policyd-spf-python

Create DNS txt record

v=spf1 mx -all

#!/usr/bin/zsh
# Script Version: 01
# Description: Script to obtain the public IP and post it to a server securely.

# Define the path to store the token
TOKEN_FILE="/root/scripts/token.txt"
LOG_FILE="/var/log/ipgetpost.log"
IP_URL="http://ip.dynproxy.net"

# Function to log messages
log_message() {
    print "$(date): $1" >> "$LOG_FILE"
}

# Set umask to ensure files are created with the correct permissions
umask 077

# Check if the token file already exists, if not, generate a new token
if [ !
  1. openssl passwd -apr1 your_password
  2. echo 'your_username:hashed_password' >> /etc/nginx/.htpasswd
  3. chmod 640 /etc/nginx/.htpasswd
  4. chown root:www-data /etc/nginx/.htpasswd
  5. vim /etc/nginx/sites-available/
location / {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
}

script

#!/bin/zsh
# Script Version: 01
# Description: Prompt for username, generate password, hash it, and save to Nginx .htpasswd

# Set variables
# ========
Tags
  1. Proxy settings — SDK https://sdk.collaboraonline.com/ documentation
  2. owncloud.DOM.TLD/index.php/apps/market/#/app/richdocuments 
  3. owncloud.DOM.TLD/index.php/settings/admin?sectionid=additional 
  4. echo 'deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-deb/ ./' | tee /etc/apt/sources.list.d/collabora.list\napt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D\napt update
Tags

1. Der "Geheime Superkraft" Witz

„Ich weiß, manche haben das geheime Superhelden-Talent 🦸‍♂️, zu nicken 👍, als hätten sie alles verstanden – selbst wenn das Gehirn 🧠 eigentlich im Schlafmodus 😴 ist. Falls das auf jemanden zutrifft, keine Sorge: Fragen ❓ sind hier die eigentliche Superkraft!“

2. Der "Rätsellöser" Witz

  1. ai nvidia-smi nvidia-detect nvidia-driver nvidia-cuda-toolkit-gcc nvidia-kernel-dkms libnvidia-encode1 libcuda1 libnvoptix1
#!/bin/sh
# Version: 1.2
# Description: Automates Borg backup process with logging, error handling,
#              and repository initialization if required.

set -e

# =============================================================================
# Configuration
# =============================================================================

# Hostname setup
FULL_HOSTNAME=$(hostname)
SHORT_HOSTNAME=$(hostname -s)

# Passphrase file
BORG_PASSPHRASE_FILE=~/.borg_passphrase

# SSH key file location
SSH_KEY="/root/.ssh/id_ed25519_$SHORT_HOSTNAME"

# Backup ser
Tags
#!/bin/bash
# Version: 1.0
# Description: This script lists all the archives in a Borg repository

set -euo pipefail

# Check if whiptail is installed
if ! command -v whiptail &> /dev/null; then
  echo "whiptail is required but not installed.
Tags

WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

Tags
  1. https://github.com/Chocobozzz/PeerTube/issues/1079#issuecomment-872256813
  2. curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
  3. ai unzip postgresql nginx gnupg2 ffmpeg redis nodejs
  4. npm install -g yarn
  5. node -v;  yarn -v
  6. https://docs.joinpeertube.org/install/any-os#installation 
    • sudo -u peertube npm install --produ
Tags
#!/bin/bash
# v01

# List and check LXC containers
echo "Listing all LXC containers..."
CONTAINERS=($(lxc-ls -1))

# Check if there are any containers
if [[ ${#CONTAINERS[@]} -eq 0 ]]; then
    echo "There are no LXC containers."
    exit 1
fi

echo "Found ${#CONTAINERS[@]} container(s): ${CONTAINERS[@]}"
echo "----------------------------------"

# Loop over each container
for LXCHOSTNAME in "${CONTAINERS[@]}"; do
    echo "Processing container: $LXCHOSTNAME"

    # Stop the container
    echo "Stopping container $LXCHOSTNAME..."
    if !

Modify your Nginx configuration to trust the proxy headers. In your server block, add:

/etc/nginx/sites-available/peertube

real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
  1. zless /usr/share/doc/logwatch/HOWTO-Customize-LogWatch.gz
  2. vim /usr/share/logwatch/default.conf/logwatch.conf
    • Detail = Med
  3. logwatch --service http --range today
  4. vim /etc/cron.daily/00logwatch
    • /usr/sbin/logwatch --mailto root

vim ~/.forward

srvlog@DOM.TLD 
 

Tags

rsnapshot.conf - no SPACES only TABS!  

Tags
  1. https://tecadmin.net/install-awstats-apache-log-analyzer-on-ubuntu/
  2. cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf-available/awstats.conf
  3. a2enconf awstats
  4. a2enmod cgi remoteip
  5. mkdir /var/lib/awstats/DOMAIN 
  6. chmod go+w /var/lib/awstats/DOMAIN
  7. vim /etc/awstats/awstats.DOMAIN.conf
  8. /etc/cron.daily/awstats

/etc/awstats/awstats.DOM.TLD.conf

Include "/etc/awstats/awstats.conf"
Sit
Tags
  1. a2enmod remoteip
  2. vim /etc/apache2/conf-available/remoteip.conf
<IfModule mod_remoteip.c>
    RemoteIPHeader X-Forwarded-For
    RemoteIPTrustedProxy 10.0.3.1
</IfModule>
  1. a2enconf remoteip
  2. systemctl restart apache2
  3. t /var/log/apache2/*.log
Tags

ai postfix postfix-pcre dovecot-core dovecot-imapd sasl2-bin libsasl2-modules

Tags
namespace inbox {
 # These mailboxes are widely used and could perhaps be created automatically:
 mailbox Drafts {
    auto = subscribe
   special_use = \Drafts
 }
 mailbox Important {
    auto = subscribe
   special_use = \Important 
 }
 mailbox Archive {
    auto = subscribe
   special_use = \Archive
 }
 mailbox Junk {
    auto = subscribe
   special_use = \Junk
 }
 mailbox Trash {
    auto = subscribe
   special_use = \Trash
 }
 # For \Sent mailboxes there are two widely used nam
Tags
START=yes
DESC="SASL Authentication Daemoni 4postfix"
NAME="saslauthd"
MECHANISMS="pam"
MECH_OPTIONS=""
THREADS=5
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"        # postfix/smtp in chroot()
  1. usermod -aG sasl postfix
  2. sc-restart postfix.service dovecot.service saslauthd.service
  3. sc-status postfix.service dovecot.service saslauthd.service
Tags
  1. ai curl apt-transport-https gnupg
  2. curl -fsSL https://dl.packager.io/srv/zammad/zammad/key |  gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-zammad.gpg> /dev/null
  3. echo "deb [signed-by=/etc/apt/trusted.gpg.d/pkgr-zammad.gpg] https://dl.packager.io/srv/deb/zammad/zammad/stable/debian 12 main"| tee /etc/apt/sources.list.d/zammad.list > /dev/null
  4. echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg]

[error] upstream sent too big header while reading response header from upstream

Tags
#!/bin/bash
# Script Version: 1.0
# Description: This script searches through BorgBackup archives for files matching a specific pattern.

set -euo pipefail

# Variables
HOSTNAME=$(hostname)
BORG_PASSPHRASE_FILE="$HOME/.borg_passphrase"
SSH_KEY="/root/.ssh/id_ed25519_$HOSTNAME"
REPO1=".at:/./borg"
LOG="/var/log/borg_find.log"
PATTERN="${1:-}" # File pattern to search for (provided as the first argument)

# Load Borg passphrase
if [ -f "$BORG_PASSPHRASE_FILE" ]; then
  export BORG_PASSPHRASE=$(cat "$BORG_PASSPHRASE_FILE")
else
  echo "Passphrase file not fou
Tags

upstream owncloud {
    server 10.0.3.IP;
}

server {
    listen 80;
    server_name owncloud.TLD;

    add_header Strict-Transport-Security max-age=31536000;
#    ssl_session_timeout  5m;
    include snippets/letsencrypt-acme-challenge.conf;
 

    location / {
        proxy_pass http://owncloud;
        include proxy_params;

server {
       server_name phpmyadmin.bubuit.net;
       add_header Strict-Transport-Security "max-age=7200";
       location / {
               proxy_pass http://10.0.3.IP;
               include proxy_params;
               proxy_ignore_client_abort on;
               
               auth_basic "Restricted";
               auth_basic_user_file /etc/nginx/htpasswd;
       }
       include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;
   listen 80; # managed by Certbot
}
  1. htpasswd -c /etc/nginx/htpasswd USERNAME

&nbsp

Tags
#!/bin/bash
# =============================================================================
# Script Name: lxc_create_container.sh
# Version: 1.1
# Description: This script creates a new LXC container from a template, assigns
#              a unique MAC address, updates the hostname and /etc/hosts file,
#              and verifies internet access.
# =============================================================================

# Prompt for the new container hostname
read -e -p "LXCHOSTNAME: " LXCHOSTNAME
export LXCHOSTNAME

# Check if the template containe
Tags
  1. ai default-mysql-client default-mysql-server
  2. mysql_secure_installation
    • mysqladmin -u root password 'PW'
  3. files
    •  /etc/mysql/my.cnf
    • /etc/mysql/debian.cnf
    • /etc/mysql/conf.d/mysqldump.cnf
    • /etc/mysql/mariadb.conf.d/50-client.cnf
Tags
#!/bin/bash
# Script Version: 1.2
# Description: Send a file via email to a specified recipient

# Set variables
EMAIL_SUBJECT="File Attachment"
EMAIL_BODY="Please find the attached file."

# Check if both email and file path are provided as arguments
if [ $# -ne 2 ]; then
   echo "Usage: $0 recipient@example.com /path/to/your/file.gz"
   exit 1
fi
RECIPIENT_EMAIL="$1"
ATTACHMENT_PATH="$2"

# Check if the file exists
if [ !
Tags
#!/bin/bash
# =============================================================================
# Script Name: f2b_status.sh
# Version: 1.6
# Description: This script retrieves and displays the status of all Fail2Ban
#              jails, including error handling and logging.
# =============================================================================

# Log file path
LOG_FILE="/var/log/fail2ban-status.log"

# Function to log messages with timestamp
log_message() {
    echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" | tee -a "$LOG_FILE"
}

# Function to retrieve t
#!/bin/sh
# Version: 1.3
# Description: Update DNS blocklist and ensure script runs in the background

LOCKFILE="/var/run/dnsbl-ipset.lock"
LOGFILE="/var/log/dnsbl-ipset.log"

# Ensure the script runs in the background
if [ -z "$BACKGROUND" ]; then
  BACKGROUND=true nohup "$0" "$@" >> $LOGFILE 2>&1 &
  exit 0
fi

{
  echo "[$(date)] Starting dnsbl-update script"

  if [ !
#!/bin/bash
# =============================================================================
# Script Name: lxc_list_sed.sh
# Version: 1.10
# Description: This script lists all LXC containers, checks their statuses, and
#              updates the SENDMAILTO field in /etc/logcheck/logcheck.conf for 
#              running containers.
Tags
#!/bin/bash
# =============================================================================
# Script Name: ipset_blacklist_reload.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script reloads an ipset with CIDR /24 network ranges from a 
#              specified file, including error handling and logging.
# =============================================================================

# Define your ipset name
IPSET_NAME="blacklist"

# Path to your list of IP network ranges, one per line
IP_LIST_PATH="/etc/firehol/blacklist.netset"

# Log fi
#!/bin/bash
# =============================================================================
# Script Name: docker_pgsql_backup.sh
# Version: 1.0
# Author: Andreas Fleckl
# Description: This script performs backups of PostgreSQL databases running in 
#              Docker containers.
#!/bin/sh
# =============================================================================
# Script Name: dnsbl_stats.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script processes the DNSBL blacklist log, generates reports
#              on IP addresses at different levels of granularity, and emails 
#              these reports.
#!/bin/zsh
# =============================================================================
# Script Name: f2b_check_ips.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script extracts and prints all banned IPs from Fail2Ban
#              jails, with an option to filter IPs based on a search argument.
#              Includes error handling and logging.
# =============================================================================

# Function to extract the list of jails
extract_jail_list() {
    # Run fail2ban-client status and extract the 
#!/bin/bash
# =============================================================================
# Script Name: lxc_package_install.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script installs a specified package in all running LXC
#              containers.
#!/bin/sh
# =============================================================================
# Script Name: hostname_update.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script retrieves the public IP address, performs a reverse 
#              DNS lookup, updates the system's hostname, and restarts the 
#              Postfix service.
Tags

listmonk/listmonk_create.sh

#!/bin/bash
# =============================================================================
# Script Name: listmonk_create.sh
# Version: 1.1
# Author: Andreas Fleckl
# Description: This script sets up a new Listmonk instance with a unique
#              configuration, database, and nginx setup.
Tags
#!/bin/sh
# =============================================================================
# Script Name: borg_backup_hetzner.sh
# Version: 1.2
# Author: Andreas Fleckl
# Description: This script performs backups using Borg to a Hetzner Storage Box.
#              It reads directories to backup and exclude from specified files,
#              handles logging, performs pruning of old backups, and sends
#              notifications about the backup status.
# =============================================================================

# Backup repository loc
Tags

ai unattended-upgrades apt-utils

/etc/apt/apt.conf.d/50unattended-upgrades

  • "site=download.opensuse.org";
  • "site=deb.nodesource.com";
  • "site=download.jitsi.org";
  • "Docker:${distro_codename}";

 

<VirtualHost *:80>
    DocumentRoot  /var/www/drupal/web/
    ServerName   DOM.TLD
    include        conf/drupal.conf
    # include        conf/awstatsauth.conf
    CustomLog    ${APACHE_LOG_DIR}/DOM.TLD_access.log combined
</VirtualHost>

/etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    Allo
Tags
  1. https://torsion.org
  2. ai borgbackup borgmatic pwgen
  3. pwgen -1cns 32

init

  1. borg init --encryption=repokey borg@BSIP:/home/borg/$HOST
  2. borg key export

Change the Passphrase

  1. export BORG_REPO="ssh://borg@BSIP/home/borg/$HOST"
  2. borg key change-passphrase

ssh keys

  1. ssh-keygen -t ed25519 
  2. ssh-copy-id -i .ssh/id_ed25519.pub borg@BSIP
  3. chmod 600 .ssh/id_ed25519
  4. eval "$(ssh-agent -s)"
Tags

Erstes Wort

grep -Eo '^[^ ]+'

Letztes Wort

grep -oE '[^ ]+$'

extract IP addresses

grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| 

exclude lines which begin with "#" or ";"

grep "^[^#;]" 

exclude empty lines and contain #

egrep -v '#|^$'

Tags

logrotate.d

  1. find /etc/logrotate.d/ -type f -exec sed -i '/postrotate/!s/rotate [0-9]\+/rotate 1/' {} \;
  2. find /etc/logrotate.d/ -type f -exec sed -i 's/daily/weekly/g' {} \;

 

  1. tail -f
  2. t
  3. systemctl --failed
  4. journalctl https://wiki.ubuntuusers.de/systemd/journalctl/
  5. colortail https://manpages.debian.org/bullseye/colortail/colortail.1.en.html
  6. multitail https://www.vanheusden.com/multitail/
  7. awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
     
Tags
  1. https://www.howtoforge.com/how-to-install-icinga-2-monitoring-software-on-debian-12/ 
  2. ai -y wget curl nano software-properties-common dirmngr apt-transport-https gnupg2 ca-certificates lsb-release debian-archive-keyring ufw unzip
  3. ai -y mariadb-server
  4. mariadb-secure-installation
  5. ai -y icinga2 monitoring-plugins
  6. ai -y icinga2-ido-mysql
  7. vim /etc/icinga2/features-available/ido-mysql.conf
  8. icinga2 feature list
Tags

vim

Numeric sort

:sort n

remove duplicate lines

:%sort u

Sorting IP addresses

:%sort n /\.\d\+\./

To adjust the indent on lines

V    select lines
>    indent

# block

Ctrl v
shift I
#
ESC ESC

replace sequences of spaces with a single tab

:'<,'>s/ \+/\t/g

Tags

/etc/nginx/snippets/letsencrypt-acme-challenge.conf

# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
location ^~ /.well-known/acme-challenge/ {
    allow all;
   # Set correct content type.
Tags
  1. omz plugin load tmux; omz plugin enable tmux
  2. omz reload
  3. omz plugin info tmux
| Alias      | Command                    | Description                                              |
| ---------- | -------------------------- | -------------------------------------------------------- |
| `ta`       | tmux attach -t             | Attach new tmux session to already running named session |
| `tad`      | tmux attach -d -t          | Detach named tmux session                                |
| `ts`       | tmux new-session -s      
Tags
  1. https://about.gitlab.com/install/#debian 
  2. https://blog.wijman.net/install-gitlab-as-container-on-proxmox/ 
  3. sysctl --system
  4. ai curl openssh-server ca-certificates perl postfix sudo

/etc/gitlab/gitlab.rb

letsencrypt['enable'] = false
package['modify_kernel_parameters'] = false
  1. gitlab-ctl reconfigure
Tags
  1. systemctl stop postgresql
  2. rm -rf /var/lib/postgresql/15/main/
  3. sudo -u postgres /usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main/
  4. systemctl start postgresql
Tags
  1. https://github.com/settings/tokens
  2. ai gh
  3. gh auth login
  4. gh repo clone user/repo
Tags
  1. ai automysqlbackup
  2. vim /etc/default/automysqlbackup
    1. BACKUPDIR="/var/backups/automysqlbackup"
    2. mkdir /var/backups/automysqlbackup
    3. /etc/cron.daily/automysqlbackup
    4. l /var/backups/automysqlbackup/daily/*/
  3. omz plugin info extract

restore

  1. unpack /var/backups/automysqlbackup/INTERVAL/DB-NAME/DB_INTERVAL_DATE.sql.COMPRESSION
    • bzip2 -dk .sql.bz2
    • gunzip .sql.gz
    • extract FILE
  2. mysql -u root -p DB-NAME < /var/backups/automysqlbackup/INTERVAL/DB
Tags
  1. ai mariadb-server
  2. mysql_secure_installation
  3. mysql -u root -p
CREATE DATABASE mattermost;
GRANT ALL PRIVILEGES ON mattermost.* TO 'mmuser'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
EXIT;
  1. wget https://releases.mattermost.com/8.1.9/mattermost-8.1.9-linux-amd64.tar.gz
  2. extract mattermost-8.1.9-linux-amd64.tar.gz
  3. mv mattermost /opt
  4. mkdir /opt/mattermost/data

/opt

Tags

init

  1. ai postgresql postgresql-contrib nginx
  2. sudo -u postgres psql
  3. create database listmonk;
  4. create user listmonk with encrypted password 'PW';
  5. grant all privileges on database listmonk to listmonk;
  6. ALTER DATABASE listmonk OWNER TO listmonk;
  7. quit
  8. https://github.com/knadh/listmonk/releases
  9. wget https://github.com/knadh/listmonk/releases/download/listmonk_VERSION_li

Mit diesen detaillierten Informationen kann die Herausforderung effektiv und zügig bewätligt werden.

Beschreibung des Problems

Präzisieren Sie das aufgetretene Problem. 
Geben Sie an, welche spezifischen Schwierigkeiten oder Fehler Sie während des Linux Debian Workshops erlebt haben.

Auszug von Log-Dateien

Falls das Problem mit bestimmten Anwendungsprotokollen oder Systemlogs in Verbindung steht, 
fügen Sie relevante Auszüge dieser Log-Dateien hinzu.

Tags

Install

  1. ai gpg
  2. curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
 $(.
Tags

/etc/ezstream/KANAL.xml

<?xml version="1.0" encoding="UTF-8"?>
<ezstream>
 <servers>
   <server>
     <hostname>127.0.0.1</hostname>
     <port>8080</port>
     <password>PW</password>
   </server>
 </servers>
 <streams>
   <stream>
     <mountpoint>/diktier.ogg</mountpoint>
     <format>Ogg</format>
   </stream>
 </streams>
 <intakes>
   <intake>
     <filename>/etc/ices2/diktier-playlist.txt</filename>
   </
Tags

/etc/postfix/virtual_domains

orangeicebear.at    ;
3dcolorprint.at        ;

/etc/aliases                             

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
logcheck: root
root: srvlogz

/etc/postfix/virtual  

Tags

/etc/postfix/header_cleanup_outgoing

/^\s*(Received: from)[^\n]*(.*)/ REPLACE $1 127.0.0.1 (localhost [127.0.0.1])$2
/^\s*User-Agent/ IGNORE
/^\s*X-Enigmail/ IGNORE
/^\s*X-Mailer/ IGNORE
/^\s*X-Originating-IP/ IGNORE
/^\s*Mime-Version/ IGNORE

/etc/postfix/main.cf

smtp_header_checks = pcre:/etc/postfix/header_cleanup_outgoing
  1. chmod 600 /etc/postfix/header_cleanup_outgoing

command is used to stop and remove containers, networks, and volumes defined in your `docker-compose.yml` file. If you run this command in the directory where your `docker-compose.yml` file is located, it will stop and remove the services.

Here's the basic usage:

docker-compose down

This will stop and remove the containers, networks, and volumes associated with your services.

If you want to also remove volumes, you can use the `-v` option:

Tags

command is used to copy files or directories between a Docker container and the local filesystem, or between containers. Here's the basic syntax:

docker cp <source_path> <container_id_or_name>:<destination_path>
docker cp <container_id_or_name>:<source_path> <destination_path>

Tags

The command is used to remove one or more containers. Here is the basic syntax:

docker rm [options] <container_id_or_name> [...]

- `<container_id_or_name>` is the ID or name of the container you want to remove.
- `[options]` are additional options you can use with the command.

For example, to remove a container with the ID `abc123`:

docker rm abc123

You can also remove multiple containers at once by specifying their IDs or names:

docker rm container1 container2 container3

Here are a couple of common options:

Tags

docker images -f dangling=true

command is used to list all "dangling" or unused images in your Docker environment. Dangling images are those that are not associated with any containers.

When you run this command, Docker will show you a list of images that are not associated with any containers. You can then decide whether to remove these dangling images using the `docker image prune` command.

If you want to remove dangling images, you can use the following command:

Tags

## Dovecot configuration file

# If you're in a hurry, see http://wiki2.dovecot.org/QuickConfiguration

# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.

# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace  "

Tags

#default_process_limit = 100
#default_client_limit = 1000

# Default VSZ (virtual memory size) limit for service processes. This is mainly
# intended to catch and kill processes that leak memory before they eat up
# everything.
#default_vsz_limit = 256M

# Login user is internally used by login processes. This is the most untrusted
# user in Dovecot system. It shouldn't have access to anything at all.
#default_login_user = dovenull

Tags

##
## SSL settings
##

# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
ssl = yes

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
ssl_cert = </etc/letsencrypt/live/mail.bubuit.net/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.bubuit.net/privkey.pem

Tags

##
## Authentication processes
##

# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
# See also ssl=required setting.
disable_plaintext_auth = no

Tags

##
## Mailbox locations and namespaces
##

Tags

A DMARC policy allows a sender to indicate that their emails are protected by SPF and/or DKIM, and give instruction if neither of those authentication methods passes. Please be sure you have a DKIM and SPF set before using DMARC.

You do not have a DMARC record, please add a TXT record to your domain _dmarc.DOM.TLD with the following value:

v=DMARC1; p=none

Tags

/var/www/srvip/mail/config-v1.1.xml

<?xml version="1.0" encoding="UTF-8"?>

Use old PC to install Debian with an bootable USB Stick 

  1. https://www.intenso.de/produkte/usb-sticks
  2. https://rufus.ie/en/
  3. https://www.debian.org/distrib/netinst

 

  1. Setting Boot Priority to USB Drive
  2. Disable Secure Boot Control, Enable CSM or Legacy Boot Mode

#
# ipv4 hash:ip ipset
#
# Maintainer        : bubu IT
# Maintainer URL    : https://bubuit.net
# List source URL    : https://blacklist.bubuit.net
# Category        : spam imap smtp fail2ban evil

Tags
  1. jitsi test mit Firefox
  2. Bildschirmauflösung 1920x1080
  3. Splitview MS Mac Gnome
    1. Links Browser
    2. Rechts Terminal
  4. Drittes icon von links im Menü "Start / Stop sharing your screen"
  5. Zugriff auf den Bildschirm erlauben
  6. Status kontrollieren
  7. 30 F

#!/bin/sh

list=$(fail2ban-client status | grep list | cut -d ":" -f2 | tr -d ',')

for i in $list; do
    fail2ban-client status $i
done

Tags

apache2/
nginx/
letsencrypt/live/

Tags

.Spam/
.Trash/
.cache/yarn/
.cpan/
.cpanm/
.npm/
.oh-my-zsh/

# Mails
USERNAME/Maildir

# Dir 
*-enabled/
alternatives/
cache/
certs/
goaccess/
ipsets/
php/
rc0.d/
rc?.d/
systemd/

# drupal
vendor/
modules/
web/core/
web/themes/
shop/bin/
files/css/
files/js/
files/php/twig/
files/translations/
files/asset_injector/
fonts/
shariff/
core/

# File Type
*.gz
*.lock
*.reason
*.swp
.rnd

Tags

crontab -e

59 23 * * *    /usr/sbin/pflogsumm -d today /var/log/mail.log | mail -s "pflogsum daily Report `date`" log@DOM.TLD
0 1 * * mon    /usr/sbin/pflogsumm /var/log/mail.log.1 | mail -s "pflogsum weekly Report `date`" log@DOM.TLD

server {
    server_name jitsi.bubuit.net;

    add_header Strict-Transport-Security "max-age=7200";

    location / {
        proxy_pass http://10.0.3.LXC-IP;
        proxy_ignore_client_abort on;
        include    proxy_params;
    }    

server {
    server_name peertube.TLD;

    access_log    off;
    open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2;

    include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;

  1. ai firehol-tools
  2. ll -t /etc/firehol/ipsets
  3. update-ipsets enable firehol_level1 firehol_level2 firehol_level3 firehol_level4 fullbogons spamhaus_drop sslbl blocklist_de greensnow ciarmy sslbl_aggressive 
  4. update-ipsets
  5. ipset -L -n
  6. ipset -L firehol_level1
  7. t /var/log/update-ipsets.log
  8. update-ipsets --help
  9. man ipset

/etc/cron.daily/update-ipsets

#!/bin/sh
update-ipsets -s > /var/log/update-ipsets.log 2>&1
 

/etc/firehol/whitelist.txt


# myips
YOUR PUBIPS

# hetzner.de
46.4.20.50

# packageist
185.56.232.198

# Mail Server
54.245.105.146
85.214.65.224
151.101.114.217 
176.9.37.124
176.9.78.130
188.40.28.171
195.145.228.186
109.73.15.86

# Top Mailserver
62.146.106.0/24
74.125.200.0/24
80.67.18.0/24
81.169.145.0/24
142.251.31.0/24
194.25.134.0/24
209.85.217.0/24

# google.com
209.85.128.0/24
209.85.214.0/24
209.85.217.0/24
209.85.219.0/24
209.85.220.0/24

Tags

server {
    server_name    netdata.TLD;

    add_header Strict-Transport-Security "max-age=7200";

sys

  1. vim /etc/hosts
  2. apt install apache2 php-{bcmath,common,curl,fpm,gd,intl,mbstring,mysql,soap,xml,xsl,zip,cli}
  3. ai mailman3-full postfix
  4. vim /etc/mailman3/mailman.cfg

apache

  1. cp /etc/mailman3/apache.conf /etc/apache2/sites-available/mailman.conf
  2. vim /etc/apache2/sites-available/mailman.conf
  3. a2ensite mailman
  4. a2dissite 000-default.conf

adduser USERNAME --shell /usr/sbin/nologin

vim /etc/postfix/virtual
postmap /etc/postfix/virtual

vim /etc/postfix/virtual_domains
postmap /etc/postfix/virtual_domains

postfix reload

IMAP over TLS

mail.DOM.TLD 993
TLS on dedicated port

SMTP over TLS

mail.DOM.TLD 587
TLS on dedicated port

# Log to syslog
Syslog            yes
SyslogSuccess           Yes
LogWhy                  Yes

# Required to use local socket with MTAs that access the socket as a non-
# privileged user (e.g. Postfix)
UMask            002

Tags

timedatectl

  • timedatectl set-timezone Europe/Vienna
  • rm /etc/localtime; ln -s /usr/share/zoneinfo/Europe/Vienna /etc/localtime

backup

  1. dpkg --get-selections > dpkg.txt

restore

  1. dpkg --clear-selections
  2. dpkg --set-selections < dpkg.txt
  3. apt-get autoremove
  4. apt-get dselect-upgrade
     

Falls du noch deinen eigenen vServer suchst, 
bietet Hetzner das passende Produkt.

Mit diesem Link kannst du mich unterstützen 
https://hetzner.cloud/?ref=7xO0A9KEFNzX

Tags
  1. https://wiki.debian.org/de/chroot
  2. https://wiki.debian.org/chroot
  3. https://wiki.debian.org/RescueLive

 

  1. mount /dev/disk/by-id/*-part1 /mnt
  2. for i in proc sys dev; do mount --bind /$i /mnt/$i; done
  3. mount --bind /dev/pts /mnt/dev/pts
  4. mount --bind /etc/resolv.conf /mnt/etc/resolv.conf
  5. chroot /mnt /bin/zsh

 

/etc/sysctrl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.NETWORKINTERFACENAME.disable_ipv6 = 1

sysctl -p

cat /proc/sys/net/ipv6/conf/*/disable_ipv6

/etc/default/grub

GRUB_CMDLINE_LINUX="xxxxx ipv6.disable=1"

update-grub

Tags
  1. mysql_secure_installation
  2. mysql -u root -p
  3. create database ocdb;
  4. grant all on ocdb.* to ocadmin@localhost identified by "PASSWD";
  5. flush privileges;
  6. quit

<VirtualHost *:80>
    DocumentRoot /var/www/owncloud/
    ServerName owncloud.TLD

    <Directory /var/www/owncloud/>
       Options +FollowSymlinks
       AllowOverride All
       Require all granted
         <IfModule mod_dav.c>
           Dav off
         </IfModule>
    </Directory>
</VirtualHost>

/etc/network/interfaces

auto enp35s0
iface enp35s0 inet static
 address 116.202.112.180
 netmask 255.255.255.192
 gateway 116.202.112.129
 # route 116.202.112.128/26 via 116.202.112.129
 up route add -net 116.202.112.128 netmask 255.255.255.192 gw 116.202.112.129 dev enp35s0

Tags
  1. ai rsyslog
  2. timedatectl
  3. timedatectl set-timezone Europe/Vienna
Tags

/etc/firehol/firehol.conf

# SYNPROXY
TRAP_PORTS="25 80"
SUSPECTS_TIMEOUT=3600
TRAP_TIMEOUT=86400
VALID_CONNECTION_COUNT=2
TRAP_ACTION="DROP"

ipv4 synproxy input inface "${wan}" dst "${PUBLIC_IPS}" dport "${TRAP_PORTS}" accept

Antigen: Another process in running.

rm ~/.antigen/.lock
oder
antigen reset

https://github.com/zsh-users/antigen/issues/543

Tags

e2scrub_all.service

Online ext4 Metadata Check for All Filesystems was skipped because of an unmet condition check (ConditionCapability=CAP_SYS_RAWIO)

https://linux.debian.bugs.dist.narkive.com/950nrKYJ/bug-926138-e2scrub-reap-service-fails-in-lxc


 

Tags

Mit diesem Code wird die Tastenkombination Alt + # (Esc + #) verwendet, 
um ein Hashtag am Anfang der aktuellen Zeile einzufügen.

insert_hashtag_at_beginning() {
 BUFFER="#$BUFFER"
 CURSOR=$((CURSOR + 1))
 zle redisplay
}

zle -N insert_hashtag_at_beginning
bindkey '\e#' insert_hashtag_at_beginning
 

Tags

/etc/cron.daily/goaccess

#!/bin/sh
goaccess

chmod +x /etc/cron.daily/goaccess

Tags

chown debian-spamd:debian-spamd -R /var/lib/spamassassin/bayes/

Tags

<VirtualHost *:80>
DocumentRoot    /usr/share/phpmyadmin
ServerName    phpmyadmin.bubuit.net

<Directory /usr/share/phpmyadmin>
   Options SymLinksIfOwnerMatch
   DirectoryIndex index.php

Tags

server {
    server_name bubuit.net;
#    add_header Strict-Transport-Security "max-age=7200";

    location / {
        proxy_pass http://10.0.3.LXC-IP;
        include proxy_params;
#        proxy_ignore_client_abort on;

server {
    server_name webradio.TLD;

    add_header Strict-Transport-Security "max-age=7200";

sort | uniq -c  | sort -nr

Tags

awk

skip first column

awk '{$1=""}1'  

print only the last column in a record

awk '{print $NF}'

print first 3 numbers from ip address 
Delimiter "."

awk -F\. '{print $1"."$2"."$3"."}'

Tags
  1. ai python3-pip
  2. pip install tldr-man
  3. echo 'alias tldr="tldr -t base16"' >> ~/.zshrc
  4. tldr omz

Links

  1. https://tldr.sh/
  2. https://tldr.inbrowser.app/
Tags
Tags
  1. history
    1. CTRL-t, CTRL-r, ALT-c
  2. cancel quit
    1. CTRL-c, CTRL-d
  3. copy Paste 
    • SHIFT-CTRL-C, SHIFT-CTRL-V (paste without format)
    • Text markieren, SHIFT-INSERT / MausRadKnopf 
    • ESC-.
  4. undo
    • C
Tags

Vim supports plugins to extend its functionality. 

  1. Here are a few popular plugin managers
  2. Install Plug by adding the following lines to your `.vimrc`:
      ```
      " Install Plug if not already installed
Tags
-='cd -'

...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -1'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
CA='2>&1 | cat -A'

Tags

sa-learn --spam /home/USER/Maildir/.Spam/
sa-learn --ham /home/USER/Maildir/.Sent/

spamassassin --add-addr-to-whitelist=IPADDRESS

Tags