-
build python 2.17 from sources
install gcc 14, set alternatives
zypper in -y gcc14-c++ gcc14 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 1 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 1 update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 1 update-alternatives --config gcc update-alternatives --config g++ update-alternatives --config c++install old version openssl
wget --no-proxy https://github.com/openssl/openssl/releases/download/OpenSSL_1_0_2d/openssl-1.0.2d.tar.gz tar -xzf openssl-1.0.2d.tar.gz cd openssl-1.0.2d ./config --prefix=/opt/openssl-1.0.2d make -j$(nproc) make installinstall python 2.17
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz tar -xzf Python-2.7.18.tgz cd Python-2.7.18 ./configure CPPFLAGS="-I/opt/openssl-1.0.2d/include/openssl" --prefix=/opt/python2.7.18 --enable-shared LDFLAGS=-Wl,-rpath=/opt/python2.7.18/lib,--disable-new-dtags --with-ensurepip=install make -j$(nproc) make installsetup virtualenv
/opt/python2.7.18/bin/pip2 install virtualenv su - user /opt/python2.7.18/bin/virtualenv --python=/opt/python2.7.18/bin/python2 ~/python2-virtualenv source ~/python2-virtualenv/bin/activate Python 2.7.18 (default, May 27 2026, 12:49:17) [GCC 14.3.1 20260409 [revision 046776dac7cc74bdbab36f450af80644a045858a]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> -
fail2ban example jail and filter (joplin server)
fail2ban jail and filter example
/etc/fail2ban/jail.d/joplin-403-sessions.conf
[joplin-403-sessions] enabled = true port = http,https filter = joplin-403-sessions action = iptables-multiport[name=joplin-403-sessions, port="http,https", protocol=tcp] sendmail-whois-lines[name=joplin-403-sessions, dest=postmaster@example.com, sender=fail2ban@example.com, logpath=/var/log/nginx/joplin.access.log] logpath = /var/log/nginx/joplin.access.log maxretry = 3 findtime = 1m bantime = 3600 ignoreip = 127.0.0.1/8/etc/fail2ban/filter.d/joplin-403-sessions.conf
[Definition] failregex = ^<HOST> - .* "(GET|POST) /api/sessions.*" 403 ignoreregex = -
PostgreSQL pg_dump pg_restore
dump and restore postgresql database
dump
#!/bin/bash if [ ! "$USER" == "postgres" ] ; then echo "user must be postgres" exit 1 fi PATH=$PATH:/srv/pgsql/bin touch /u04/export/in_progress for db in $(echo "select datname from pg_database where datname <>'template0'" | psql --no-align --quiet --tuples-only ); do mkdir -p "/u04/export/$db" echo "dump database $db..." backup_file="/u04/export/$db/pg_dump__${db}__$(date +%Y-%m-%d__%H-%M-%S)" pg_dump $db -Fd -f $backup_file && pg_dump $db -Fp --schema-only -f $backup_file/schema.sql if [[ $?==0 ]]; then echo "export to $backup_file success" else echo "export failed" fi done rm /u04/export/in_progressrestore
pg_restore -d test4 -Fd /u04/export/test4/pg_dump__test4__2025-08-21__11-43-18/ pg_restore -d test4 -Fd -a /u04/export/test4/pg_dump__test4__2025-08-21__11-43-18/ pg_restore -d test4 -Fd -t dt_fake_data -a /u04/export/test4/pg_dump__test4__2025-08-21__11-43-18/ -
access to hilink web interface from remote host
hilink usb dongle on remote host
remote host
sysctl -w net.ipv4.ip_forward=1 iptables -t nat -A PREROUTING --dst 10.10.10.22 -p tcp --dport 80 -j DNAT --to 192.168.8.1 iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADElocal host
#sysctl -w net.ipv4.ip_forward=1 #sysctl -w net.ipv4.conf.all.route_localnet=1 iptables -t nat -A OUTPUT -d 192.168.8.1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.10.10.22 iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE -
apache rewrite without 301 redirect
/etc/apache2/conf.d/domaincheck.conf
AddDefaultCharset UTF-8 Alias /domainchecker "/srv/www/htdocs/domainchecker" <Location "/domainchecker"> DirectoryIndex index.php RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ [L] </Location> <Directory "/srv/www/htdocs/domainchecker"> DirectorySlash Off Options -Indexes +FollowSymLinks Require all granted </Directory>