From 77205d26ead19ab6f63c63f9b1875e30a6158805 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 Feb 2011 18:04:52 +0100 Subject: added checklog script to check if user exists, that were not created with the lduseradd script --- checklog | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 checklog diff --git a/checklog b/checklog new file mode 100755 index 0000000..22f84bc --- /dev/null +++ b/checklog @@ -0,0 +1,30 @@ +#!/bin/bash +# Copyright (c) 2011 Alexander Sulfrian +# This script should check if only that user exists, that are created +# by the lduseradd script. + +tmp=$(mktemp) +ldapsearch | grep "^dn: uid=[a-z]\+,ou=People,dc=spline" | sort > "${tmp}" + +grep -v "^[[:blank:]]*\(#\|$\)" /var/db/useradd/users.log | sort | \ + diff -u - "${tmp}" | \ + sed -n 's/^+dn: uid=\([a-z]\+\),.*$/\1/ p' | \ + while read user; do + sendmail -t <> /var/db/useradd/users.log + echo "# WARNING: THIS USER WAS NOT CREATED BY THE LDUSERADD TOOL" >> /var/db/useradd/users.log + echo "dn: uid=$user,ou=People,dc=spline,dc=inf,dc=fu-berlin,dc=de" >> /var/db/useradd/users.log + echo >> /var/db/useradd/users.log + done + +# clean up +rm -f ${tmp} -- cgit v1.2.3