dynamic ip and mail port updates
authorIan Kelling <iank@fsf.org>
Mon, 13 May 2019 14:42:52 +0000 (10:42 -0400)
committerIan Kelling <iank@fsf.org>
Mon, 13 May 2019 14:42:52 +0000 (10:42 -0400)
brc
distro-end
dynamic-ip-update
mail-route
mail-setup
switch-mail-host
vpn-mail-forward

diff --git a/brc b/brc
index c243706a73660932f6994e4e84214cdf5c7d282f..487ee8f1dae06254b7bc6280e0053d8c18423c3b 100644 (file)
--- a/brc
+++ b/brc
@@ -1087,25 +1087,19 @@ ipdrop() {
   s iptables -A INPUT -s $1 -j DROP
 }
 
-jr() { journalctl "$@"; }
-
-net-dev-info() {
-  e "lspci -nnk|gr -iA2 net"
-  lspci -nnk|gr -iA2 net
-  hr
-  e "s lshw -C network"
-  hr
-  s lshw -C network
-
-}
 
 istext() {
   grep -Il "" "$@" &>/dev/null
 }
 
+jfilter() {
+  grep -Evi -e "^(\S+\s+){4}(sudo|sshd|cron)\[\S*:" \
+       -e "^(\S+\s+){4}systemd\[\S*: (starting|started) (btrfsmaintstop|dynamicipupdate|spamd dns bug fix cronjob|rss2email)\.*$"
+}
 jtail() {
-  journalctl -n 10000 -f "$@" | grep -Evi "^(\S+\s+){4}(sudo|sshd|cron)"
+  journalctl -n 10000 -f "$@" | jfilter
 }
+jr() { journalctl "$@" | jfilter | less ; }
 
 kff() { # keyboardio firmware flash
   pushd /a/bin/distro-setup/Arduino/Model01-Firmware
@@ -1243,6 +1237,15 @@ mkdir() { command mkdir -p "$@"; }
 
 mo() { xset dpms force off; } # monitor off
 
+net-dev-info() {
+  e "lspci -nnk|gr -iA2 net"
+  lspci -nnk|gr -iA2 net
+  hr
+  e "s lshw -C network"
+  hr
+  s lshw -C network
+
+}
 
 nopanic() {
   sudo tee -a /var/log/exim4/paniclog-archive </var/log/exim4/paniclog; sudo truncate -s0 /var/log/exim4/paniclog
index c22e1130be39b67136dd60c5581f0776c1674771..1b25a55eced2a26e3dd6e5a74903af810ca14adf 100755 (executable)
@@ -1565,6 +1565,9 @@ s fc-cache
 /a/bin/distro-setup/mymimes
 
 
+sgo dynamicipupdate
+
+
 # stop autopoping windows when i plug in an android phone.
 # dbus-launch makes this work within an ssh connection, otherwise you get this message,
 # with still 0 exit code.
index 007570cd53576637078596f0ce89ab326f20f425..185eef2ec0adbd1a54e14fa73465ea9bbb314eb9 100755 (executable)
@@ -55,6 +55,7 @@ if $up4; then
   cat >>$f <<EOF
 update delete b8.nz. A
 update add b8.nz. 300 A $ip4
+update add wrt.b8.nz. 300 A $ip4
 EOF
 fi
 
index 11f92c60513709bd9b400bb61a00879745034edd..428972094d11ccff467d48d03b416a364e6127ec 100755 (executable)
@@ -21,7 +21,7 @@ usage() {
   cat <<'EOF'
 Usage: mail-route up|down|show
 
-Marks tcp packets on port 25 and 143 to be routed through
+Marks tcp packets on port 25, 143 and 587 to be routed through
 a vpn ip. If called from --up/--down in openvpn, (we have multiple args) $1 is the
 tun_dev, and action is from $script_type.
 
@@ -115,7 +115,7 @@ iptmod() { #iptables modify
 modify() {
   # match source or dest port. note, when we send to a port, it picks a random high port as
   # the source.
-  for port in 25 143; do # smtp and imap.
+  for port in 25 143 587; do # smtp and imap.
     iptcommon="OUTPUT -m tcp -p tcp -m multiport --ports $port -j MARK --set-mark"
     iptmod iptables -t mangle $iptables_op $iptcommon 0x1
     iptmod iptables -t mangle $iptables_op $iptcommon 0x0 -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
index babbbd8dc3668c428167f8d3adae9d17bc6aa0a8..f43b6ba8b136ab697a19b210c5fd10b1109c87e9 100755 (executable)
@@ -205,7 +205,7 @@ pi() { # package install
 
 postmaster=$u
 mxhost=mail.iankelling.org
-mxport=25
+mxport=587
 forward=$u@$mxhost
 
 # old setup. left as comment for example
@@ -644,6 +644,9 @@ EOF
     # would be unused in that config type.
     rm -f /etc/exim4/conf.d/main/000_localmacros # old filename
     cat >/etc/exim4/conf.d/main/000_local <<EOF
+# enable 587 in addition to the default 25, so that
+# i can send mail where port 25 is firewalled by isp
+daemon_smtp_ports = 25 : 587
 # i don't have ipv6 setup for my vpn tunnel yet.
 disable_ipv6 = true
 
index 5d7a6793388dd76b181b5b893eae590c4f1b1fdb..b6423e08395dffc4daf52bf73e400508f7d77e96 100755 (executable)
@@ -65,9 +65,8 @@ if [[ ! $new_host || ! $old_host ]]; then
   exit 1
 fi
 
-# TODO: turn this home dns update into a separate script that also runs
-# as a cronjob for the MAIL_HOST, so it can update dns for a laptop that
-# moves to a different network.
+# TODO: make home dns use ipv6. for work, make a cronjob that updates
+# the dns there.
 #
 # This exists because if mail_host is on the home network with a vpn
 # tunnel, and another host on the home network tries to connect to the
index 76da42481e041fad201295ce24a2e1f875621a1d..30159a130f604d32c7b2026ce1913724ad160871 100755 (executable)
@@ -10,7 +10,7 @@ do-forward() {
     done
 }
 
-ports=(25 143)
+ports=(25 143 587)
 case $1 in
     start)
         do-forward -A ${ports[@]}