Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r2422 - branches/fsvs-1.2.x/fsvs/example/debian: . apt.d etc etc/ssl scripts

fsvs
Discussion topic

Back to topic list

svn commit: r2422 - branches/fsvs-1.2.x/fsvs/example/debian: . apt.d etc etc/ssl scripts

Author tekknokrat
Full name Gunnar Thielebein
Date 2010-02-04 03:51:23 PST
Message Author: tekknokrat
Date: 2010-02-04 03:51:22-0800
New Revision: 2422

Added:
   branches/fsvs-1.2.x/​fsvs/example/debian/​
   branches/fsvs-1.2.x/​fsvs/example/debian/​README
   branches/fsvs-1.2.x/​fsvs/example/debian/​apt.d/
   branches/fsvs-1.2.x/​fsvs/example/debian/​apt.d/75fsvs
   branches/fsvs-1.2.x/​fsvs/example/debian/​etc/
   branches/fsvs-1.2.x/​fsvs/example/debian/​etc/config
   branches/fsvs-1.2.x/​fsvs/example/debian/​etc/ssl/
   branches/fsvs-1.2.x/​fsvs/example/debian/​etc/ssl/servers
   branches/fsvs-1.2.x/​fsvs/example/debian/​ignore
   branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/
   branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/apt-hook.py (contents, props changed)
   branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/fsvs-cron

Log:
add files for Debian/Ubuntu configuration monitoring

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​README
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/README?view=markup​&pathrev=2422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​README 2010-02-04 03:51:22-0800
@@ -0,0 +1,9 @@
+This files are proposed for a configuration monitoring scenario of a Debian/Ubuntu based linuxhost.
+The folder structure does not reflect directly the filesystem thats why a short explaination:
+
+ - ''apt.d'' this contains configuration for the apt-hook
+ - ''etc'' this contains fsvs config files
+ - ''etc/ssl'' fsvs config file for ssl transport
+ - ''scripts'' contains a cron script and the apt-hook
+
+''ignore'' contains a sample ignore ruleset, ignoring temp. created files and most password files (chmod filter).

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​apt.d/75fsvs
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/apt.d/75fsvs?view=​markup&pathrev=2​422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​apt.d/75fsvs 2010-02-04 03:51:22-0800
@@ -0,0 +1 @@
+Dpkg::Post-Invoke { "/usr/share/fsvs/scr​ipts/apt-hook.py"; };

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​etc/config
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/etc/config?view=ma​rkup&pathrev=242​2
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​etc/config 2010-02-04 03:51:22-0800
@@ -0,0 +1 @@
+author=$SUDO_USER

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​etc/ssl/servers
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/etc/ssl/servers?vi​ew=markup&pathre​v=2422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​etc/ssl/servers 2010-02-04 03:51:22-0800
@@ -0,0 +1,8 @@
+[groups]
+fsvs = fsvs.repository.host
+[fsvs]
+ssl-client-cert-file = /etc/ssl/private/newcert.p12
+ssl-client-cert-password = 1k3kl0aU
+[global]
+ssl-authority-files = /etc/ssl/default/cacert.pem
+store-plaintext-passwords=yes

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​ignore
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/ignore?view=markup​&pathrev=2422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​ignore 2010-02-04 03:51:22-0800
@@ -0,0 +1,11 @@
+ignore,m:004:000
+ignore,/**.gz
+ignore,/**.bz2
+ignore,/**.zip
+ignore,/**.rar
+ignore,/etc/fsvs
+ignore,/etc/resolv.conf
+ignore,/etc/mtab
+ignore,/etc/adjtime
+take,/etc/
+ignore,/**

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/apt-hook.py
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/scripts/apt-hook.p​y?view=markup&pa​threv=2422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/apt-hook.py 2010-02-04 03:51:22-0800
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+
+import sys, commands, subprocess
+from os import stat
+from os import path
+import string
+
+msg_prfx = 'fsvs-apt-hook_'
+
+def getLine(list):
+ result = []
+ for i in list:
+ if ('Removing' in i) or ('Setting up' in i) or ('Purging' in i) or ('Configuring' in i):
+ line = string.replace(i, '\r', '')
+ result.append(line)
+ return result
+
+def getLastAptAction():
+ logfn = '/var/log/apt/term.log'
+ try:
+ FILE = open(logfn, 'r')
+ except:
+ print 'could not open file'
+ lineList = FILE.readlines()
+ length = len(lineList)
+ FILE.close()
+ result = []
+ curline = lineList[-1]
+ if 'Log ended:' in curline:
+ cond = False
+ i = 1
+ while cond == False and (length-i)>0:
+ i+=1
+ curline = lineList[length-i]
+ if not 'Log started:' in curline:
+ result.insert(1,curline)
+ else:
+ cond = True
+ msg = getLine(result)
+ msg.insert(0, msg_prfx + 'last-apt-action:\n')
+ return(msg)
+
+def getDpkgFiles():
+ cmd = 'dpkg-deb --contents %s' % pkg_file
+ print cmd
+ try:
+ out = commands.getoutput(cmd)
+ except:
+ print 'exception running %s' % cmd
+ exit()
+ list = string.split(out, '\n')
+ print list[1]
+
+""" gets "fsvs st" state for working copy /
+"""
+def getFsvsStatus():
+ cmd = 'fsvs st /'
+ out = commands.getoutput(cmd)
+ list = string.split(out, '\n')
+ return list
+
+def getConfigChanges():
+ list = getFsvsStatus()
+ if len(list) > 0:
+ print('The following is a list of files that are changed on dpkg-tasks:')
+ for i in list:
+ print i
+ res = raw_input('Do you want to commit these files? (y/N)')
+ if res.lower() == 'y':
+ return True
+ else:
+ return False
+
+def ciConfigChanges(msg):
+ ci_file = '/tmp/fsvs_cm'
+
+ try:
+ FILE = open(ci_file, 'w')
+ except:
+ print 'could not open file %s' % ci_file
+
+ for line in msg:
+ FILE.write(line)
+ FILE.close()
+
+ args =['fsvs', 'ci', '/', '-F', ci_file]
+ res = subprocess.Popen(args)
+
+def checkFsvsEnviron():
+ """ check fsvs bin availability
+ """
+ if not path.exists('/usr/bin/fsvs'):
+ print msg_prfx + 'error: no instance of fsvs found'
+ quit()
+
+ """ check fsvs configuration
+ """
+ cmd = 'fsvs / urls dump'
+ if not len(commands.getoutput(cmd)) > 0:
+ print msg_prfx + 'error: no urls defined for /'
+ quit()
+
+ """ check fsvs connectivitiy to repo
+ """
+ cmd = 'fsvs / remote-status'
+ if commands.getstatusoutput(cmd) == '1':
+ print msg_prfx + 'error: no repo available'
+ quit()
+
+if __name__ == '__main__':
+
+ checkFsvsEnviron()
+ commitmsg = getLastAptAction()
+
+ if getConfigChanges():
+ ciConfigChanges(commitmsg)

Added: branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/fsvs-cron
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/example/debia​n/scripts/fsvs-cron?​view=markup&path​rev=2422
====================​====================​====================​==================
--- (empty file)
+++ branches/fsvs-1.2.x/​fsvs/example/debian/​scripts/fsvs-cron 2010-02-04 03:51:22-0800
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+FSVS_BIN=$(which fsvs)
+FSVS_OPTS="-ostop_change=true -ofilter=mtime,text,​owner,mode,group,new​,deleted"
+
+if ! $FSVS_BIN st / $FSVS_OPTS;then
+
+echo "fsvs has detected changes in monitored directories."
+echo ""
+echo "changed files:"
+echo "-------------------​--------------------​------------"
+echo ""
+$FSVS_BIN st /
+echo ""
+echo "user last logged in:"
+echo "-------------------​--------------------​------------"
+echo ""
+last -n 3
+echo ""
+echo "diff of the files changed:"
+echo "-------------------​--------------------​-------------"
+echo ""
+$FSVS_BIN diff /
+
+fi

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r2422 - branches/fsvs-1.2.x/fsvs/example/debian: . apt.d etc etc/ssl scripts tekknokrat Gunnar Thielebein 2010-02-04 03:51:23 PST
Messages per page: