[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

errata_check script.



Hi,

I wrote this simple script that checks  if  there  are  any  changes  on
openbsd.org/errata.html and mails them to root. I hope  people  find  it
usefull.

If it is considered really usefull I could rewrite it  as  a  patch  for
/etc/security.

Suggestions and remarks are welcome.



Cya, Han.
#!/bin/sh

# This script checks for updates on the errata.html page. It should be run from
# /etc/daily.local

# This is going to be the working-dir of this script.
if [ ! -d /var/erratacheck ];then
	mkdir /var/erratacheck
fi
cd /var/erratacheck


mail_root() {
cat mail4root|mail -s 'Securitty warning! Check http://openbsd.org/errata.html' root
}


if [ ! -e errata.txt.old ];then
	lynx -dump http://openbsd.org/errata.html > errata.txt.old
	cat > mail4root << EOF

It seems like this is a fresh install. Don't forget to look at:

  http://openbsd.org/errata.html

To check if there are any security-updates that have to  be  done.

EOF

	mail_root
	rm mail4root
	exit 0
fi

lynx -dump http://openbsd.org/errata.html > errata.txt

diff -u0 errata.txt.old errata.txt > errata.diff

if [ -s errata.diff ]; then
	cat > mail4root << EOF

There has been an update on the http://openbsd.org/errata.html page.

The text of this update was:

EOF
	# Insert the diff without the diff headers into the message.
	cat errata.diff |\
		grep -v "^--- errata.txt.old" |\
		grep -v "^+++ errata.txt"|\
		grep -v "^@@.\+@@" >> mail4root
	mail_root
	rm mail4root errata.diff
	mv -f errata.txt errata.txt.old

else
	echo "No action on the errata-front today."
	rm -f errata.txt errata.diff
fi



Visit your host, monkey.org