Snippets
Short, reusable code and configuration snippets. Review before running in production.
; php.ini (or per-site FPM pool)
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,show_source
expose_php = Off
allow_url_include = Off
Open code page →
# /etc/systemd/system/myapp.service.d/override.conf
[Service]
Restart=on-failure
RestartSec=5
StartLimitIntervalSec=300
StartLimitBurst=5
Open code page →
#!/usr/bin/env bash
set -euo pipefail
SRC=/var/www/
DST=/backup/www
NOW=$(date +%F)
rsync -aH --delete --link-dest="$DST/latest" "$SRC" "$DST/$NOW"
ln -sfn "$DST/$NOW" "$DST/latest"
Open code page →
SELECT table_schema, table_name,
ROUND((data_length + index_length) / 1024 / 1024, 1) AS size_mb
FROM information_schema.tables
ORDER BY (data_length + index_length) DESC
LIMIT 20;
Open code page →
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "same-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
server_tokens off;
Open code page →
# What is exposed, and what is broken?
ss -tulpn
systemctl --failed
journalctl -p err -b --no-pager | tail -n 50
Open code page →
DEVEL_MODE="0"
INSTALL_PATH="/etc/apf"
IFACE_UNTRUSTED="eth0"
IFACE_TRUSTED=""
USE_IPV6="1"
SET_VERBOSE="1"
SET_FASTLOAD="1"
SET_VNET="0"
SET_ADDIFACE="0"
SET_MONOKERN="0"
DOCKER_COMPAT="auto"
SET_EXPIRE="600"
PERMBLOCK_COUNT="5"
PERMBLOCK_INTERVAL="86400"
Full code (140 lines) →
email_alert="1"
email_addr="[email protected]"
email_ignore_clean="1"
email_subj="maldet alert from $(hostname)"
email_panel_user_alerts="0"
email_panel_from="[email protected]"
email_panel_replyto="[email protected]"
email_panel_alert_subj="maldet alert from $(hostname)"
email_format="html"
smtp_relay=""
smtp_from=""
smtp_user=""
smtp_pass=""
slack_alert="0"
Full code (99 lines) →