2012-08-26 12:15:08 +00:00
|
|
|
#!/bin/rc
|
|
|
|
rfork e
|
|
|
|
fn checkhost {
|
|
|
|
if(~ $sysname ''){
|
|
|
|
echo 'sysname= env var is not set'
|
|
|
|
exit 'fail'
|
|
|
|
}
|
2012-08-26 14:10:01 +00:00
|
|
|
dom=`{ndb/query sys $sysname dom}
|
2012-08-26 12:15:08 +00:00
|
|
|
echo 'checking this host''s tuple:'
|
2012-08-26 13:56:16 +00:00
|
|
|
if(~ $dom '')
|
2012-08-26 12:15:08 +00:00
|
|
|
echo ' no dom= entry'
|
|
|
|
if not if(! ~ $dom *.*)
|
|
|
|
echo ' dom='$dom 'does not have a dot'
|
|
|
|
if not if(! ~ $dom $sysname^.*)
|
|
|
|
echo ' dom='$dom 'does not start with' $sysname^'; it''s supposed to be the FQDN, not the domain name!'
|
|
|
|
if not
|
|
|
|
echo ' dom='$dom 'looks ok'
|
2012-08-26 14:10:01 +00:00
|
|
|
ether=`{ndb/query sys $sysname ether}
|
2012-08-26 12:15:08 +00:00
|
|
|
if(~ $ether '')
|
|
|
|
echo ' no ether entry'
|
|
|
|
if not if(! ~ $ether [0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])
|
|
|
|
echo ' ether='$ether 'has wrong format'
|
|
|
|
if not if(! grep -s $ether /net/ether*/addr)
|
|
|
|
echo ' ether='$ether 'does not belong to any network interface'
|
|
|
|
if not
|
|
|
|
echo ' ether='$ether 'looks ok'
|
|
|
|
}
|
|
|
|
fn checknet {
|
|
|
|
echo 'checking the network tuple:'
|
|
|
|
ipnet=`{ndb/ipquery sys $sysname ipnet | sed 's/^ipnet=//'}
|
|
|
|
if(~ $ipnet ''){
|
|
|
|
echo ' we are not in an ipnet, check your ipnet= entry'
|
|
|
|
exit fail
|
|
|
|
}
|
|
|
|
if not
|
|
|
|
echo ' we are in ipnet='^$ipnet
|
2012-08-26 14:10:01 +00:00
|
|
|
dns=`{ndb/query ipnet $ipnet dns}
|
2012-08-26 12:15:08 +00:00
|
|
|
if(~ $dns '')
|
|
|
|
echo ' no dns= entry'
|
|
|
|
if not if(! ip/ping -n 1 $dns >/dev/null >[2=1])
|
|
|
|
echo ' dns='$dns 'does not reply to ping'
|
|
|
|
if not
|
|
|
|
echo ' dns='$dns 'looks ok'
|
2012-08-26 14:10:01 +00:00
|
|
|
auth=`{ndb/query ipnet $ipnet auth}
|
2012-08-26 12:15:08 +00:00
|
|
|
if(~ $auth '')
|
|
|
|
echo ' no auth= entry'
|
|
|
|
if not if(! ip/ping -n 1 $auth >/dev/null >[2=1])
|
|
|
|
echo ' auth='$auth 'does not reply to ping'
|
|
|
|
if not {
|
|
|
|
authok=1
|
|
|
|
echo ' auth='$auth 'looks ok'
|
|
|
|
}
|
2012-08-26 14:10:01 +00:00
|
|
|
authdom=`{ndb/query ipnet $ipnet authdom}
|
2012-08-26 12:15:08 +00:00
|
|
|
if(~ $authdom '')
|
|
|
|
echo ' no authdom= entry'
|
|
|
|
if not
|
|
|
|
echo ' authdom='$authdom 'looks ok'
|
|
|
|
}
|
|
|
|
fn checkauth {
|
|
|
|
echo 'checking auth server configuration:'
|
2012-08-26 14:10:01 +00:00
|
|
|
auth=`{ndb/query ipnet $ipnet auth}
|
2012-08-26 12:15:08 +00:00
|
|
|
if(~ $auth ''){
|
|
|
|
echo ' no auth server'
|
|
|
|
exit fail
|
|
|
|
}
|
|
|
|
if not if(~ $auth $sysname){
|
|
|
|
echo ' we are the auth server'
|
|
|
|
authisus=1
|
|
|
|
}
|
|
|
|
if not if(~ $auth $dom){
|
|
|
|
echo ' we are the auth server'
|
|
|
|
authisus=1
|
|
|
|
}
|
|
|
|
if not {
|
|
|
|
echo ' we are not the auth server '^$auth
|
|
|
|
echo ' if this is a mistake, set auth='$sysname' or auth='$dom
|
|
|
|
if(~ $authok 1)
|
|
|
|
echo ' run auth/debug to test the auth server'
|
|
|
|
}
|
|
|
|
if(~ $authisus 1){
|
|
|
|
if(! grep -s keyfs <{ps})
|
|
|
|
echo ' auth/keyfs is not running, try reboot'
|
|
|
|
if not
|
|
|
|
echo ' auth/keyfs is running'
|
|
|
|
if(! grep -s 'Listen *567' <{netstat -n})
|
|
|
|
echo ' no one listening on port 567, try reboot'
|
|
|
|
if not {
|
|
|
|
echo ' someone is listening on port 567'
|
|
|
|
echo ' run auth/debug to test the auth server'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
fn checksec {
|
|
|
|
echo 'checking basic security:'
|
|
|
|
if(@{rfork n; mount -n /srv/boot /root >/dev/null >[2=1]})
|
2012-08-26 14:10:01 +00:00
|
|
|
echo ' file server does not require auth for user '^`{cat '#c'/user}
|
2012-08-26 12:15:08 +00:00
|
|
|
if not
|
|
|
|
echo ' file server seems to require auth'
|
|
|
|
}
|
|
|
|
checkhost
|
|
|
|
checknet
|
|
|
|
checkauth
|
|
|
|
checksec
|