- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Crontab Modification script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 05:17 AM
07-07-2003 05:17 AM
Crontab Modification script
Kyle Harris
Cpl USMC
Unix Administrator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 05:29 AM
07-07-2003 05:29 AM
Re: Crontab Modification script
crontab -l > filename
diff filename filename.bck > filename_with_differences
#send mail if file is not empty
if [ -s filename_with_difference ]
then
code to sendmail
fi
cp filename filename.bck
rm filename_with_differences
Schedule this script in crontab and let it run
every hour or so
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 05:44 AM
07-07-2003 05:44 AM
Re: Crontab Modification script
23 3 * * * /usr/contrib/bin/checkcron 2>&1 | mailx -s "Crontab Check Script" reciepint@usmc.go v
Better yet, in the detect script, only send the email if there has been a change.
Logic
diff crontab.current crontab.stable > /tmp/file
fname=/tmp/file
if [ -s $fname ] then # if file is greater than 0 byes.
mailx -s "Cron has been changed" recipient@usmc.gov
fi
That should work.
Side Note: Thank you for your service. We're proud of our forces here in Chicago.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 05:50 AM
07-07-2003 05:50 AM
Re: Crontab Modification script
I do plan on running it every 10 min or so to check for changes in the crontab.
PS. Steven, thanks for the sidenote. I'm originally from Aurora, IL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 05:57 AM
07-07-2003 05:57 AM
Re: Crontab Modification script
something like tripwire, although it does much more then what your asking.
IDS/9000 should be able to do this for you also.
By default, IDS/9000 provides templates for matching activity associated with the following types of intrusions/attacks: buffer overflow attack, race condition attack, creation of setuid files, creation of world-writeable files, repeated failed su commands, repeated failed logins, modification of files and directories, changes to log files, modification of another user's files, monitoring the start of interactive sessions and monitoring logins/logouts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 06:01 AM
07-07-2003 06:01 AM
Re: Crontab Modification script
23 3 * * * /usr/contrib/bin/checkcron 2>&1 | mailx -s "Crontab Check .... I understand what this does but what does the 2>&1 do after the script name. & is Background but i'm not sure about the 2> 1 part.... Thanks for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 06:03 AM
07-07-2003 06:03 AM
Re: Crontab Modification script
Where can i obtain that program you were talking about? And can it work with Redhat or just HP-UX ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 06:14 AM
07-07-2003 06:14 AM
Re: Crontab Modification script
the x>&y syntax makes standard output (or the file descriptor x) a duplicate of the file descriptor whose number is given by y.
in your case standard error is made a duplicate of standard input, i.e. your scripts error messages will go to the same place as it's ouput, the mail message.
tripwire is a commerial product (it'll cost you), but i do think there is a less capable free opensource version for linux.
www.tripwire.com
IDS/9000 is an hp product, which i believe is only available on HP unix.
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=J5083AA
Hopefully others with more security experience can provide other tools that are available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2003 08:56 PM
07-07-2003 08:56 PM
Re: Crontab Modification script
I think they might have had an old version of tripwire there, or something much like it. I honestly can't recall. I know they had md5... I wrote my own tripwire type application with that. The code that the others provided you should work just fine. HP-UX comes with a built in chksum tool if you want to just check the file that way. Keep it simple, and document what ever you do. I've written a ton of awesome code that 2 years later I can't remember even how to run. haha.
-Brian.