host info updates
authorIan Kelling <ian@iankelling.org>
Sun, 28 Apr 2024 17:59:33 +0000 (13:59 -0400)
committerIan Kelling <ian@iankelling.org>
Sun, 28 Apr 2024 17:59:33 +0000 (13:59 -0400)
brc2
easiest-to-type-numbers
machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8 [deleted file]
machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo [deleted file]
machine_specific/li/filesystem/etc/openvpn/client-config-hole/x2
machine_specific/x2/filesystem/etc/systemd/system/openvpn-client-tr@.service

diff --git a/brc2 b/brc2
index 05de0a3f1cf93cbc19db5213794c83b6a129807f..3edbae0f26a47871cf1e0d733f570d0b935f8995 100644 (file)
--- a/brc2
+++ b/brc2
@@ -2650,7 +2650,7 @@ host-info-all() {
 host-info-update() {
 
   local -A vpn_ips host_ips host_macs nonvpn_ips all_ips
-  local -a root_hosts nonroot_hosts host_usbs
+  local -a root_hosts nonroot_hosts
 
   # the hosts with no mac
   root_hosts=( bk je li b8.nz )
@@ -2687,6 +2687,7 @@ host-info-update() {
       # hosts is that it is for the User part, the IdentityFile part is
       # redundant to *.b8.nz. Also note ${host}i, we only setup those for vpn hosts, but there is no harm in overspecifying here.
       root_hosts+=($host ${host}i $host.b8.nz ${host}i.b8.nz)
+      root_hosts_a[$host]=t  # a for associative array
     else
       nonroot_hosts+=($host ${host}i)
     fi
@@ -2756,7 +2757,7 @@ EOF
   # shellcheck disable=SC2016 # shellcheck doesnt know this is sed
   sedi '/edits below here are made automatically/,$d' /p/c/machine_specific/li/filesystem/etc/wireguard/wgmail.conf
   for host in ${!vpn_ips[@]}; do
-    if [[ ${root_ips[$host]} ]]; then
+    if [[ ${root_hosts_a[$host]} ]]; then
       # root machines dont actually need vpn, but
       # the classification still helps with other
       # configurations.
@@ -2764,7 +2765,7 @@ EOF
     fi
     ipsuf=${vpn_ips[$host]}
     wghole $host $ipsuf
-    sd /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/$host <<EOF
+    u /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/$host <<EOF
 ifconfig-push 10.5.5.${vpn_ips[$host]} 255.255.255.0
 EOF
     u /a/bin/ds/machine_specific/$host/filesystem/etc/systemd/system/openvpn-client-tr@.service <<EOF
@@ -2819,7 +2820,7 @@ EOF
 
   {
     echo "cat <<EOF"
-    for host in ${!host_ips[@]}; do
+    for host in ${!host_macs[@]}; do
       ipsuf=${host_ips[$host]}
       echo "dhcp-host=${host_macs[$host]},set:$host,\$l.$ipsuf,$host"
     done
@@ -2870,15 +2871,23 @@ EOF
 /p/c/machine_specific filesystem/etc/wireguard/wghole.conf
 EOF
 
-  files=(/b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/* )
+  files=( /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/* )
   for f in "${files[@]}"; do
-    host=${f##/*}
+    host=${f##*/}
     if [[ ! ${vpn_ips[$host]} ]]; then
       e rm $f
       e ssh root@li.b8.nz rm -f $f
     fi
   done
 
+
+  {
+    printf "%s" "Host * "
+    sed -n '/^Host /h;/^IdentityFile .*\/home/{g;s/^Host//;s/ / !/gp}' ~/.ssh/config | tr '\n' ' '
+    echo "IdentityFile ~/.ssh/work"
+  } | cedit work-identity ~/.ssh/config || [[ $? == 1 ]]
+
+
 }
 
 # usage host ipsuf [extrahost]
index 279151f22da8d9edf885a84df6e156766ffc4c96..6d5e59301bc8978a88089967e625426db7b2038c 100755 (executable)
@@ -74,7 +74,7 @@ t4() {
       pn $d1$d2
       used[$d1$d2]=t
     done
-  done
+  done | sort -n
 }
 
 for t in {1..4}; do
diff --git a/machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8 b/machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8
deleted file mode 100644 (file)
index efe7832..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ifconfig-push 10.5.5.32 255.255.255.0
diff --git a/machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo b/machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo
deleted file mode 100644 (file)
index 7fbb17c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ifconfig-push 10.5.5.34 255.255.255.0
index 16ef1379a025bca200ce6f41c4e098053909d5b3..24af30f0e3790848dba0a9104bc79eeca0f7c2b8 100644 (file)
@@ -1 +1 @@
-ifconfig-push 10.5.5.23 255.255.255.0
+ifconfig-push 10.5.5.28 255.255.255.0
index 8a764b1d519eae011a7edbaa1fc36c308daae1d0..9d386a8acd43531b214fd3a1e2c9cf14d1644657 100644 (file)
@@ -24,10 +24,10 @@ LimitNPROC=10
 # we use .1 to make this be on a different network than kd, so that we can
 # talk to transmission on kd from remote host, and still use this
 # vpn.
-ExecStartPre=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.23 start %i
+ExecStartPre=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.28 start %i
 ExecStartPre=/sbin/iptables-restore /a/bin/distro-setup/transmission-firewall/netns.rules
 # allow wireguard network to connect
-ExecStartPre=/usr/sbin/ip r add 10.8.0.0/24 via 10.174.23.1 dev veth1-client
+ExecStartPre=/usr/sbin/ip r add 10.8.0.0/24 via 10.174.28.1 dev veth1-client
 ExecStopPost=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
 PrivateNetwork=true
 BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind