audit: Added files and scripts.
This commit is contained in:
parent
3d533aa1db
commit
b92a710039
|
@ -0,0 +1,12 @@
|
|||
# Audit
|
||||
|
||||
Actuellement, deux voies d'audit :
|
||||
- liste des paquets Debian utilisés ;
|
||||
- test vrms.
|
||||
|
||||
# 2023
|
||||
|
||||
Résultat de l'audit du 04/01/2023 :
|
||||
- les paquets :
|
||||
- le test vrms :
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 2023-01-04 Cpm
|
||||
|
||||
align_dpkgs()
|
||||
{
|
||||
local source_file="$1"
|
||||
local letter="$2"
|
||||
|
||||
# Find the longest position.
|
||||
local max=0
|
||||
while read -r line; do
|
||||
if [[ $line =~ '||/ N' ]]; then
|
||||
local pos=$(expr index "$line" "$letter")
|
||||
if (( $pos > $max)); then
|
||||
max=$pos
|
||||
fi
|
||||
fi
|
||||
done < "$source_file"
|
||||
|
||||
# Insert spaces.
|
||||
local currentpos=0
|
||||
local middle=""
|
||||
while read -r line; do
|
||||
#echo -e "$line\n"
|
||||
if [[ $line =~ '||/ N' ]]; then
|
||||
local currentpos=$(expr index "$line" "$letter")
|
||||
currentpos=$(($currentpos-1))
|
||||
local diff=$(($max-currentpos-1))
|
||||
middle=$(printf %${diff}s)
|
||||
|
||||
local start=${line:0:currentpos}
|
||||
local end=${line:currentpos}
|
||||
echo "${start}${middle}${end}"
|
||||
|
||||
elif [[ $line =~ 'ii ' ]]; then
|
||||
local start=${line:0:currentpos}
|
||||
local end=${line:currentpos}
|
||||
echo "${start}${middle}${end}"
|
||||
fi
|
||||
done < "$source_file"
|
||||
}
|
||||
|
||||
# ##############################################################################
|
||||
|
||||
# Put all dpkg -l output in one file.
|
||||
dpkg -l --no-pager > tmp
|
||||
for guest in $(cat machines.txt) ;
|
||||
do
|
||||
ssh -t admin666@$guest dpkg -l --no-pager >> tmp
|
||||
done
|
||||
|
||||
# Align the column Version.
|
||||
align_dpkgs "tmp" "V" > tmp2
|
||||
|
||||
# Align the column Architecture.
|
||||
align_dpkgs "tmp2" "A" > tmp
|
||||
|
||||
# Output cleaned lines.
|
||||
grep "^ii" tmp | sort | uniq
|
||||
|
||||
# Clean temprary files.
|
||||
rm tmp tmp2
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
for guest in $(cat machines.txt) ;
|
||||
do
|
||||
echo "===== $guest ====="
|
||||
ssh -t admin666@$guest vrms
|
||||
done
|
|
@ -0,0 +1,3 @@
|
|||
alpha@foo.bar
|
||||
bravo@foo.bar
|
||||
charlie@foo.bar
|
Loading…
Reference in New Issue