# For first time running the program creates an encrypted fingerprint
# datafile of the system binaries of particular folders.
#
# Second time it compares fingerprints of the binaries currently found
# on the system with the ones formerly stored.
#
# The encrypted fingerprint datafile should be stored somewhere else
# outside the current system because attackers can also create it
# by themselves!
#
# The program is advised to be run with root privileges.
# It uses gpg with symmetric encryption.
# Fingerprint datafile should be deleted and recreated after system update.
# Name of datafile that contains the fingerprints of system binaries
# (full path is allowed too)
OF="system_binaries_fingerprints.gpg"
# Name of temporary files
TF1=`mktemp -u`
TF2=`mktemp -u`
# Paths to the folders to look in
PT="/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin"
echo
if [ -a $OF ]
then
echo Searching for binaries...
find $PT -type f | sort | xargs sha1sum > $TF1
echo Decrypting datafile...
gpg -q -o $TF2 -d $OF
echo Comparing fingerprints...
if diff $TF1 $TF2; then
echo Results OK!
fi
rm -f $TF1 $TF2
echo Done.
echo
else
echo No datafile found under the name $OF !
echo Do you want to create it? [y/N]
read -n 1 -s ENC
if [ "$ENC" = "y" ]
then
echo Searching for binaries...
find $PT -type f | sort | xargs sha1sum > $TF1
echo Encrypting datafile...
if gpg -q -o $OF -c $TF1
then
echo File has been created with the name $OF !
echo Done.
echo
else
echo Failure.
echo
fi
rm -f $TF1
else
echo Nothing done.
echo
fi
fi
[/code]
- log69 blogja
- A hozzászóláshoz be kell jelentkezni
- 862 megtekintés
Hozzászólások
Az előzőt Debian alatt teszteltem, itt a FreeBSD verzió (talán ez így kicsit kompatibilisebb):
-----------------------------------------------------------
# ------------------------------------------
# --- CHECK SYSTEM BINARIES FINGERPRINTS ---
# ------------------------------------------
# For first time running the program creates an encrypted fingerprint
# datafile of the system binaries of particular folders.
#
# Second time it compares fingerprints of the binaries currently found
# on the system with the ones formerly stored.
#
# The encrypted fingerprint datafile should be stored somewhere else
# outside the current system because attackers can also create it
# by themselves!
#
# The program is advised to be run with root privileges.
# It uses gpg with symmetric encryption.
# Fingerprint datafile should be deleted and recreated after system update.
# Name of datafile that contains the fingerprints of system binaries
# (full path is allowed too)
OF="system_binaries_fingerprints.gpg"
# Name of temporary files
TF1=`mktemp -u tmp.XXXXXX`
TF2=`mktemp -u tmp.XXXXXX`
# Paths to the folders to look in
PT="/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin"
echo
if [ -f $OF ]
then
echo Searching for binaries...
find $PT -type f | sort | xargs sha1 > $TF1
echo Decrypting datafile...
gpg -q -o $TF2 -d $OF
echo Comparing fingerprints...
if diff $TF1 $TF2; then
echo Results OK!
fi
rm -f $TF1 $TF2
echo Done.
echo
else
echo No datafile found under the name $OF !
echo Do you want to create it? [y/N]
# read -n 1 -s ENC
read ENC
if [ "$ENC" = "y" ]
then
echo Searching for binaries...
find $PT -type f | sort | xargs sha1 > $TF1
echo Encrypting datafile...
if gpg -q -o $OF -c $TF1
then
echo File has been created with the name $OF !
echo Done.
echo
else
echo Failure.
echo
fi
rm -f $TF1
else
echo Nothing done.
echo
fi
fi
- A hozzászóláshoz be kell jelentkezni
ezzel 1 a gond: mivan ha az itt felhasznalt programok lettek hibasak? (sha1sum, gpg, stb)
--
A vegtelen ciklus is vegeter egyszer, csak kelloen eros hardver kell hozza!
- A hozzászóláshoz be kell jelentkezni
Természetesen CSAK is első telepítéskor érdemes futtatni. Utána nincs értelme. Szerintem ez egyértelmű.
- A hozzászóláshoz be kell jelentkezni
pedig pont az a lenyege hogy rendszeresen ellenorizni lehessen. a debian csomagokban szerepel minden telepitett file ellenorzoosszege tehat nem kell kulon scanelgetni hanem mindjart lehet ellenorizni. nyilvan egy forrasalapu disztronal ez igy nem mukodik
udv Zoli
- A hozzászóláshoz be kell jelentkezni
irnal arrol hogy melyik programokat probaltad es miert nem tetszettek?
udv Zoli
- A hozzászóláshoz be kell jelentkezni
Kicsit elkéstél vele. Telepítés után első dolgod kellett volna, hogy legyen.
Másrészt a tripwire nem véletlenül olyan, amilyen, szóval én ezt nem bíznám egy scriptre. Túl sok ponton támadható. Magyarul továbbra sem lehetsz biztos semmiben.
------------------------
Debian testing KDE amd64
MSI K8N-Neo-4, Athlon64 3800+, Leadtek 6600GT
- A hozzászóláshoz be kell jelentkezni
Az nem tetszik a tripwire-ben az mellett hogy nem olyan egyszerű mint amilyennek lennie kellene, hogy annyira mégsem egyszerűen ellenőrizhető mint egy script meg a text file amit az generál.
- A hozzászóláshoz be kell jelentkezni
Igen, lehet. Viszont talán az egyetlen biztos pont lehet a rendszerben.
Ha már ujjlenyomatot ellenőrzünk, legalább az integritás-ellenőrző csomag legyen megbízható. Félmunkát végezni csak időpocsékolás.
------------------------
Debian testing KDE amd64
MSI K8N-Neo-4, Athlon64 3800+, Leadtek 6600GT
- A hozzászóláshoz be kell jelentkezni
rkhunter nem jó?
--
Debian - The "What?!" starts not!
http://nyizsa.uni.cc
- A hozzászóláshoz be kell jelentkezni
Addig jó, amíg épp az rkhunter binárisa nincs módosítva/kicserélve.
------------------------
Debian testing KDE amd64
MSI K8N-Neo-4, Athlon64 3800+, Leadtek 6600GT
- A hozzászóláshoz be kell jelentkezni
file /usr/bin/rkhunter
/usr/bin/rkhunter: POSIX shell script text executable
Hm?
--
Debian - The "What?!" starts not!
http://nyizsa.uni.cc
- A hozzászóláshoz be kell jelentkezni
Naná, hogy a neve ugyanaz marad :) Még a funkciója is majdnem. Csak egy-két apróságot esetleg nem mutat. Az rkhunter.dat fájlt, ami alapján az összehasonlítást végzi, módosíthatta-e valaki? Az rkhunter fájlról készített hash megegyezik-e azzal, amit telepítettél? És ha igen, az md5sum (sha1sum) igazat mond-e? És ha igen, az adatbázisfájl, amivel összehasonlítod a fájl ujjlenyomatát, érintetlen-e, vagy már hamis adat van benne?
------------------------
Debian testing KDE amd64
MSI K8N-Neo-4, Athlon64 3800+, Leadtek 6600GT
- A hozzászóláshoz be kell jelentkezni
Persze, de te az rkhunter binárisáról beszéltél, ami nincs, mivel script. Akárcsak az, amit a topicnyitó írt. A tárolt hasheket persze módosíthatta akárki, de ez a fönti scriptre is igaz.
Nem azt mondtam, hogy ultimate megoldás, csak azt kérdeztem, hogy ez a script miért jobb.
--
Debian - The "What?!" starts not!
http://nyizsa.uni.cc
- A hozzászóláshoz be kell jelentkezni
AIX-ben ilyen celra van kulon telepitesi opcio, a TCB (Trusted Computing Base), szoval ott csak a gyari DVD-ben kell megbizni ;-)
- A hozzászóláshoz be kell jelentkezni