echo -n "$x" | xclip
}
+# a1 = awk {print $1}
+for field in {1..20}; do
+ eval a$field"() { awk '{print \$$field}'; }"
+done
+# h1 = head -n1
+for num in {1..9}; do
+ eval h$num"() { head -n$num}; }"
+done
+
+
b() {
# backwards
c -
# exit "$@" 2>/dev/null
}
+# reapply bashrc
+reb() {
+ source ~/.bashrc
+}
+
rl() {
readlink -f "$@"
}
m sl $h <<'EOF'
source ~/.bashrc
m dnsup
+EOF
+ done
+}
+bindpushb8() {
+ lipush
+ for h in li bk; do
+ m sl $h <<'EOF'
+source ~/.bashrc
+m dnsup
m dnsb8
EOF
done
}
+
dnsup() {
conflink
m ser reload bind9
ran_d=false
system-status _
case $PS1 in
- *\]D\ *)
+ *[\ \]]D\ *)
pushd /
/b/ds/distro-begin || return $?
/b/ds/distro-end || return $?
popd
ran_d=true
;;&
- *\]DB\ *)
+ *[\ \]]DB\ *)
pushd /
/b/ds/distro-begin || return $?
popd
ran_d=true
;;
- *\]DE\ *)
+ *[\ \]]DE\ *)
pushd /
/b/ds/distro-end || return $?
popd
# mu personality. for original, just run mp. for 2, run mp 2.
# this is partly duplicated in mail-setup
mp() {
- killall mu ||:
+ local dead=false
+ for s in {1..5}; do
+ if ! killall mu; then
+ dead=true
+ break
+ fi
+ sleep 1
+ done
+ if ! $dead; then
+ echo error: mu not dead
+ m psg mu
+ return 1
+ fi
suf=$1
set -- /m/mucache ~/.cache/mu /m/.mu ~/.config/mu
while (($#)); do
$s /a/exe/teeu "$@"
}
-# a1 = awk {print $1}
-for field in {1..20}; do
- eval a$field"() { awk '{print \$$field}'; }"
-done
-
enn() {
local ecmd pid
s $ecmd "$@"
return
fi
- pid=$(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|a1)
+ pid=$(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|h1)
m s nsenter -t $pid -n -m $ecmd "$@"
}
vpnf() {
vpncmd sudo --preserve-env=PATH -E -u iank abrowser -no-remote -P vpn &r
}
+vpn2f() {
+ vpncmd sudo --preserve-env=PATH -E -u iank abrowser -no-remote -P vpn2 &r
+}
+
vpni() {
vpncmd sudo --preserve-env=PATH -E -u iank "$@"
}
[Unit]
Description=OpenVPN tunnel for %I
-After=syslog.target network-online.target
+After=syslog.target network-online.target vpn-static-ip@%i.service
+Requires=vpn-static-ip@%i.service
Wants=network-online.target
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
--- /dev/null
+[Unit]
+Description=vpn-static-ip
+
+
+[Service]
+Type=oneshot
+ExecStart=/b/ds/vpn-static-ip /etc/openvpn/client/%i.conf
# todo: mailtest-check failure on remote hosts is not going to alert me.
# sort that out.
-
+# todo: test that mail is dkim signing in our mail test.
+# todo: send sending from all domains
+# todo: test mail failure as well as success.
+# todo: we should monitor spamhaus etc to make sure we dont get blacklisted.
# background: I want to run exim in a network namespace so it can send
# and receive through a vpn. This is needed so it can do ipv6, because
--- /dev/null
+#!/bin/bash
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
+
+conf=$1
+
+# We block dns lookups from going outside the vpn network namespace,
+# there might be some other workaround, but just resolving to static ips
+# is a simple fix.
+
+sed --follow-symlinks -i '/^ *remote /d' $conf
+ret=1
+while read -r host port; do
+ while read -r ip; do
+ printf "remote %s %s\n" "$ip" "$port" >>$conf
+ ret=0
+ done < <(dig +short $host ||:)
+done < <(sed -rn 's/^ *# *remote //p' $conf)
+if ((ret)); then
+ echo "vpn-static-ip: error: failed to set any ips" >&2
+ exit 1
+fi