The figure below calls out
- The netfilter hooks
- The order of table traversal
<a rel="me" href="https://noc.social/@libr8r">Mastodon</a> |
#!/bin/bash | |
# Exit if any variables are unset. May need to be uncommented if trying to expand positional parameters. | |
set -u | |
# Try to catch errors, but beware that some non-zero conditions are OK | |
set -e | |
# Capture errors within a pipeline | |
set -o pipefail |
# From: https://google.github.io/styleguide/shellguide.html | |
err() { | |
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2 | |
} | |
if ! do_something; then | |
err "Unable to do_something" | |
exit 1 | |
fi |
# Credit: https://www.loggly.com/install/configure-linux.sh | |
#trapping Control + C | |
#these statements must be the first statements in the script to trap the CTRL C event | |
trap ctrl_c INT | |
function ctrl_c() { | |
# Do something here | |
exit 1 |
#!/usr/bin/env bash | |
profile=network-throughput | |
# Usage: die message ... | |
die() { | |
printf '%s\n' "$*" >&2 | |
exit 1 | |
} |
From: https://access.redhat.com/solutions/24845 | |
set SELINUX=permissive in /etc/selinux/config | |
Run fixfiles onboot or touch /.autorelabel | |
reboot | |
check the /var/log/messages and /var/log/audit/audit.log for new SELinux messages | |
set SELINUX=enforcing in /etc/selinux/config | |
Run fixfiles onboot or touch /.autorelabel | |
reboot |
cd /mnt/foo | |
mount -t proc /proc proc/ | |
mount --rbind /sys sys/ | |
mount --rbind /dev dev/ |
Source: Matt Springfield. Original source unknown. | |
In /etc/bashrc (or profile): | |
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"' | |
For rsyslog: in /etc/rsyslog.d/bash.conf: | |
Local6.* /var/log/commands.log (or wherever you want to send the data) |
Source: https://www.sitepoint.com/basics-json-syntax-tips/ | |
quotation mark “ | |
forward slash / | |
back slash \ | |
new line n | |
carriage return r | |
tab t |