LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-13-2010, 02:19 PM   #1
mrtwice
Member
 
Registered: Feb 2002
Distribution: xubuntu 8.10
Posts: 225

Rep: Reputation: 31
Helper program/script to create a changelog for a server that runs on logout?


I am working on getting our Linux (and eventually Windows if possible) systems setup so that we can monitor administrative changes and have a history of them to refer to. Currently, I have a pretty good setup going with etckeeper, logwatch, and mercurial keeping track of installed packages, /etc, etc.

I would like to make this just a bit more robust by nagging any admin when they logoff with a message that asks them if they would like to create a changelog for what they just did on the server. A "no" answer would continue the logoff process and a yes answer would take them to their default edit where they could enter whatever they wanted about what they just changed on the system. The changlog helper would then add some standard formatting to their comments (add a date/time, username, indent, rewrap to 70 chars per line, etc.) and prepend that to a file somewhere on the system. I would then include that changelog in the monitoring setup I have already which would result in it being version controlled and sent to a centralized location.

I am envisioning something that would look and work very much the way the commit/comment feature works with mercurial/git/svn, except the comment gets formatted different and saved to a file locally.

I realize something like this probably doesn't exist, so I would also be looking for pointers on how I might script it. I have the skill to handle the formatting, writing to the changelog file, etc.

My uncertainties arise when I consider how I might hook this into the logout routine and default editor of the user. Also, how would I know to run the hook for a real user but not for something like sftp/scp, etc.

Thanks.
 
Old 08-14-2010, 01:38 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Quote:
Originally Posted by mrtwice View Post
I would like to make this just a bit more robust by nagging any admin when they logoff with a message that asks them if they would like to create a changelog for what they just did on the server.
Failing to understand why it is important to sign off on changes right after they are made leads to not logging anything, or in case one is forced to entering anything that gets the user past it like just "blah", so I wonder if it is useful or will make things more robust. This being first and foremost a matter of discipline, your standard weapon of choice should be education, not technology IMO. Also there could be potential problems like attributing and claiming changes, for instance one user logging out while another is still editing configuration files, changes made the sneaky way, changes made in earlier or interrupted sessions or simply forgetting to list everything that's been changed.


Quote:
Originally Posted by mrtwice View Post
The changelog helper would then add some standard formatting to their comments (add a date/time, username, indent, rewrap to 70 chars per line, etc.) and prepend that to a file somewhere on the system.
Submitting to syslog (one of the local slots?) using 'logger' (can take aprox 300 words per line) gets you a date and timestamp and $LOGNAME should be in the unprivileged users shell environment. Else why not just use a plain text file and a macro that adds a date and timestamp?


Quote:
Originally Posted by mrtwice View Post
I am envisioning something that would look and work very much the way the commit/comment feature works with mercurial/git/svn, except the comment gets formatted different and saved to a file locally.
Ah, like using 'sudo etckeeper commit "unusually short, incomplete, non-descriptive and utterly uninteresting message.";'? ;-p


Quote:
Originally Posted by mrtwice View Post
My uncertainties arise when I consider how I might hook this into the logout routine and default editor of the user. Also, how would I know to run the hook for a real user but not for something like sftp/scp, etc.
Only allowing shells that support a ~/.*logout script would be the easiest I think and a default editor you could set if none can be detected. Running a shell that is not interactive (SCP at least IIRC) should be easy to detect with 6.3.3 Interactive Shell Behavior.


* Also since this is not about Linux Security I'll move your thread to the Linux General forum or any other forum if you select a fitting one.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create alias that runs a shell-script tarqertil Linux - Software 2 07-01-2008 01:20 PM
Create new script that runs on startup pnellesen SUSE / openSUSE 1 01-23-2007 08:29 PM
How to create script that runs a command on boot up EFiNi7 SUSE / openSUSE 5 08-09-2006 10:43 PM
How do i create a KDE desktop icon which runs a program using a different group-id? jcosenzo Linux - General 3 06-10-2006 09:44 AM
logout after script runs bigdog0007 Linux - Newbie 6 06-24-2005 05:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration