diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-11-29 20:26:12 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-11-29 20:26:12 +0000 |
commit | 43eb7eea62595cbb180873e7087a0e4cd8900a9c (patch) | |
tree | 806b5bd3433a0f39d45ace49ab43ea29f7bddc25 /rc/bin/netaudit | |
parent | d3743d40c2c7d0cfe2d41518dc1d61c2ca277ac9 (diff) |
netaudit: check for sys= attribute to be free of periods
Diffstat (limited to 'rc/bin/netaudit')
-rwxr-xr-x | rc/bin/netaudit | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/rc/bin/netaudit b/rc/bin/netaudit index 739126c09..71dbab5ff 100755 --- a/rc/bin/netaudit +++ b/rc/bin/netaudit @@ -16,6 +16,13 @@ fn checkip { if not echo ' looks ok' } +fn checksys { + echo -n ' '$1'='$2 + if(~ $2 *.*) + echo ' contains a dot, it will be confused for a domain name or ip address' + if not + echo ' looks ok' +} fn checkdom { echo -n ' '$1'='$2 if(! ~ $2 *.*) @@ -27,10 +34,19 @@ fn checkdom { } fn checkhost { if(~ $sysname ''){ - echo 'sysname= env var is not set' + echo 'env var $sysname is not set' exit 'fail' } + checksys 'env var $sysname' $sysname echo 'checking this host''s tuple:' + sys=`{ndb/ipquery sys $sysname sys | sed 's/sys=//g'} + if(! ~ $sysname $sys) + echo ' no sys= entry' + if not { + for(i in $sys){ + checksys sys $i + } + } ip=`{ndb/ipquery sys $sysname ip | sed 's/ip=//g'} if(~ $ip '') echo ' no ip= entry' @@ -118,7 +134,7 @@ fn checkauth { echo ' no auth server' exit fail } - if not if(~ $sysname $auth){ + if not if(~ $sys $auth){ echo ' we are the auth server' authisus=1 } |