#!/usr/bin/perl # # Mail filter script which sends a page to my cell phone if and only if # it's a FreeBSD security advisory. Probably best to let procmail run # it, with a recipe such as: # # :0c # * ^From.*FreeBSD # |$HOME/src/advisorypage.pl # # To do: This should also be able to handle other peoples' security # advisories, such as Debian. # # 19 Feb 2001 by Michael Dickerson # Portions taken from Larry Wall's vacation program # # 23 Mar 01 MAD: added match against Sender: header, designed to # avoid multiple pages for multiple mailing lists $PAGE_ADDR = "your-pager@address.here"; $/ = ''; # paragraph mode $header = <>; # read all text up to first blank line $header =~ s/\n\s+/ /g; # fix continuation lines $header =~ /^From: FreeBSD Security Advisories/m or exit; $header =~ /^Sender: owner-freebsd-security-notifications/m or exit; while(<>) { ($topic) = ($_ =~ /^Topic:\s+(.+)\n/m) unless $topic; ($category) = ($_ =~ /^Category:\s+(.+)\n/m) unless $category; ($module) = ($_ =~ /^Module:\s+(.+)\n/m) unless $module; } open(MAIL, "|/usr/sbin/sendmail -oi -t $PAGE_ADDR") or die "Can't run sendmail: $!\n"; print MAIL < $topic ($category/$module) EOF close MAIL; exit;