Include subnet-qualified names names for hosts.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 30 Apr 2012 08:59:14 +0000 (09:59 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 30 Apr 2012 08:59:14 +0000 (09:59 +0100)
bin/sign
etc/hosts

index 17d7d22..29add64 100755 (executable)
--- a/bin/sign
+++ b/bin/sign
@@ -35,6 +35,7 @@ while read line <&3; do
   set -- $line
   host=$1
   names=""
+  nicks=""
 
   ## If this is a different host, then start a new section of the list.
   case "$last" in
@@ -46,10 +47,10 @@ while read line <&3; do
 
   ## Build a list of names for the host.
   for n in "$@"; do
-    names=${names:+$names,}$n
     case "$n" in
-      *.* | *:*) ;;
-      *) names=${names:+$names,}$n.$domain ;;
+      .*) for h in $nicks; do names=${names:+$names,}$h$n,$h$n.$domain; done ;;
+      *.* | *:*) names=${names:+$names,}$n ;;
+      *) nicks=${nicks:+$nicks }$n names=${names:+$names,}$n,$n.$domain ;;
     esac
   done
 
index 19aea08..8020c5b 100644 (file)
--- a/etc/hosts
+++ b/etc/hosts
@@ -2,43 +2,44 @@
 
 ## Servers.
 ibanez \
-       62.49.204.153 2001:470:1f09:1b98::9 \
-       172.29.199.14 2001:470:9740:1::14
+       .dmz 62.49.204.153 2001:470:1f09:1b98::9 \
+       .unsafe 172.29.199.14 2001:470:9740:1::14
 radius \
-       62.49.204.146 2001:470:1f09:1b98::2 \
-       172.29.199.1 2001:470:9740:1::1 \
-       172.29.199.193 2001:470:9740:4001::1 \
-       172.29.198.1 2001:470:9740:8001::1
+       .dmz 62.49.204.146 2001:470:1f09:1b98::2 \
+       .unsafe 172.29.199.1 2001:470:9740:1::1 \
+       .safe 172.29.199.193 2001:470:9740:4001::1 \
+       .untrusted 172.29.198.1 2001:470:9740:8001::1
 roadstar \
-       62.49.204.147 2001:470:1f09:1b98::3 \
-       172.29.199.2 2001:470:9740:1::2
+       .dmz 62.49.204.147 2001:470:1f09:1b98::3 \
+       .unsafe 172.29.199.2 2001:470:9740:1::2
 jem \
-       62.49.204.148 2001:470:1f09:1b98::4 \
-       172.29.199.3 2001:470:9740:1::3
+       .dmz 62.49.204.148 2001:470:1f09:1b98::4 \
+       .unsafe 172.29.199.3 2001:470:9740:1::3
 artist \
-       62.49.204.149 2001:470:1f09:1b98::5 \
-       172.29.199.4 2001:470:9740:1::4
-       172.29.198.2 2001:470:9740:8001::2
+       .dmz 62.49.204.149 2001:470:1f09:1b98::5 \
+       .unsafe 172.29.199.4 2001:470:9740:1::4 \
+       .untrusted 172.29.198.2 2001:470:9740:8001::2
 fender \
-       212.13.198.69 2001:ba8:0:1d9::2 \
-       172.29.199.177 2001:ba8:1d9:2::1
+       .jump 212.13.198.69 2001:ba8:0:1d9::2 \
+       .colo 172.29.199.177 2001:ba8:1d9:2::1
 precision \
-       212.13.198.70 2001:ba8:0:1d9::3 \
-       172.29.199.178 2001:ba8:1d9:2::2
+       .jump 212.13.198.70 2001:ba8:0:1d9::3 \
+       .colo 172.29.199.178 2001:ba8:1d9:2::2
 telecaster tele \
-       212.13.198.71 2001:ba8:0:1d9::4 \
-       172.29.199.179 2001:ba8:1d9:2::3
+       .jump 212.13.198.71 2001:ba8:0:1d9::4 \
+       .colo 172.29.199.179 2001:ba8:1d9:2::3
 stratocaster strat \
-       212.13.198.72 2001:ba8:0:1d9::5 \
-       172.29.199.180 2001:ba8:1d9:2::3
+       .jump 212.13.198.72 2001:ba8:0:1d9::5 \
+       .colo 172.29.199.180 2001:ba8:1d9:2::3
 jazz \
-       212.13.198.73 2001:ba8:0:1d9::6 \
-       172.29.199.181 2001:ba8:1d9:2::4
-vampire git git-master ftp \
-       62.49.204.150 2001:470:1f09:1b98::6 \
-       172.29.199.5 2001:470:9740:1::14 \
-       172.29.199.194 2001:470:9740:4001::2 \
-       172.29.198.3 2001:470:9740:8001::3
+       .jump 212.13.198.73 2001:ba8:0:1d9::6 \
+       .colo 172.29.199.181 2001:ba8:1d9:2::4
+vampire \
+       .dmz 62.49.204.150 2001:470:1f09:1b98::6 \
+       .unsafe 172.29.199.5 2001:470:9740:1::14 \
+       .safe 172.29.199.194 2001:470:9740:4001::2 \
+       .untrusted 172.29.198.3 2001:470:9740:8001::3 \
+       git git-master ftp
 
 ## Workstation and occasional guests.
 gibson