Intâlnesc destul de des intrebari legate de protectia serverului root. Multi webmasteri detin un root server sau un vhosting si se lovesc de problema administrarii. Iata mai jos lista mea de comenzi salvate care îmi sunt de folos la nevoie:
/etc/init.d/psa stopall
umount -a
xfs_check /dev/md1
xfs_repair /dev/md1
xfs_check /dev/md5
xfs_repair /dev/md5
xfs_check /dev/md6
xfs_repair /dev/md6
xfs_check /dev/md7
xfs_repair /dev/md7
xfs_check /dev/md8
xfs_repair /dev/md8
mount /dev/md1 /mnt
mount /dev/md6 /mnt/var
mount /dev/md5 /mnt/usr
mount /dev/md7 /mnt/home
mount /dev/md8 /mnt/srv
chroot /mnt
/etc/init.d/psa start
Bineînteles, comenzile de mai sus trebuie sa reflecte partitionarea existenta pe serverul Dvs.
less ~/.bash_history
sau
history
NB: Aceste doua comenzi functioneaza DOAR daca istoria nu a fost setata la 0 (de exemplu una din urmatoarele doua comenzi a fost executata în sesiunea precedenta >.bash_history sau export HISTSIZE=0)
vi /etc/proftpd.conf
/etc/init.d/xinetd restart
top
/etc/apache/httpd.conf
/etc/apache/server-tunning.conf
/var/log/apache2
netstat -nt
netstat -anp |grep ‘tcp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
netstat -anp |grep ‘udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
iptables -I INPUT -s 217.218.36.11 -j DROP
mysqldump –user=admin –password=SSSS –create-options database_name > /tmp/database_name.sql
or
mysqldump -user=admin –password= SSSS –all-databases -p –create-options | bzip2 -c > databasebackup.sql.bz2
or
mysqldump -uadmin -pSSSS –all-databases –create-options | bzip2 -c > databasebackup2.sql.bz2
Nota: Recomand cu caldura oprirea serviciului MySQL înainte de a lansa oricare din comenzile de backup de mai sus.
mysql -uadmin -pSSSS database_name < /tmp/database_name.sql
Nota: Daca în momentul crearii dump-ului s-a folosit parametrul –create-options, bazele de date vor fi create automat în momentul importului.
rm -f /usr/local/psa/var/lib/webalizer/webalizer.cache
touch /usr/local/psa/var/lib/webalizer/webalizer.cache
chown root:root /usr/local/psa/var/lib/webalizer/webalizer.cache
chmod 644 /usr/local/psa/var/lib/webalizer/webalizer.cache
stat -f /usr/local/psa/var/lib/webalizer/webalizer.cache
cd /usr/local/psa/admin/sbin/
/usr/local/psa/admin/sbin/statistics
/etc/init.d/mysql restart
/usr/local/psa/bin/pleskbackup all ftp://username:password@backup.onlinehome-server.info/httpdocs/backup.file
/usr/local/psa/bin/pleskbackup all allbackup.file
tar czf /srv/www/vhosts backup
tar czf /volumes/myexternaldrive/backup01.tgz myfolder
tar -xzvf MyArchive.tgz Source_file
or
tar –extract –gunzip –verbose –file=MyArchive.tgz Source_file
tar xzvf /volumes/myexternaldrive/backup01.tgz myfolder/subfolder/thefiletorestore
rpm -Uvh ftp://fr2.rpmfind.net/linux/SuSE-Linux/i386/update/10.2/rpm/x86_64/php5-soap-5.2.0-12.x86_64.rpm
mysql -uadmin -pparola baza_date < /srv/www/vhosts/domeniu.com/httpdocs/clean.sql
cat /proc/version
cat /etc/issue
sau în functie de distributia folosita:
cat /etc/redhat-release
cat /etc/debian_version
wget http://superb-east.dl.sourceforge.net/sourceforge/rkhunter/rkhunter-1.3.4.tar.gz
tar -xzvf rkhunter-1.3.4.tar.gz
cd rkhunter-1.3.0.tar.gz
./installer.sh –layout /usr/local –install
add RHunter in cronjob
vi /etc/cron.daily/rkhunter.sh
and add
#!/bin/bash
/usr/local/bin/rkhunter -c | mail -s “RKhunter Scan Details” email@domain.com
exit 0
wget –passive-ftp ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
tar xvfz chkrootkit.tar.gz
cd chkrootkit-/
./chkrootkit
netstat -an |grep “[.:]${465}[^0-9.]”
netstat -e -p
netstat -a |grep 4000
netstat -e -p -n -a | grep 465
ps ax | grep 3456
vi /etc/ssh/sshd_config (change to the port 8993)
/etc/rc.d/sshd restart
iptables -A INPUT -m tcp -p tcp –dport 8993 -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m tcp -p tcp –dport 8993 -m state –state NEW -m limit –limit 2/min –limit-burst 2 -j ACCEPT
iptables -A INPUT -m tcp -p tcp –dport 8993 -j DROP
netstat -lptu
find / -name pleskbackup
sau mai rapid în momentul în care ati create un index al fisierelor din sistem. Executati ca si root updatedb (se recomanda rularea ei in cron zilnic sau saptamânal în functie de numarul de fisiere din sistem) si o data ce comanda a creat indexul pentru a localiza un fisier landati doar comanda: locate filename
Pentru a afla calea completa a comenzilor din PATH-ul Dvs. folositi: which filename
du -a /var | sort -n -r | head -n 10
find . -type f -size +500000k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’
rm -rf /fisier
/var/lib/zmd/zmd.db
ps -axfu | grep parse-metadata
kill -9 32323 (pid-ul procesului gasit cu comanda anterioara)
rm /var/lib/zmd/zmd.db
/etc/init.d/novell-zmd start
cat /etc/passwd |grep -v nologin | cut -d: -f1
w
who -a
users
last (include de asemenea lista tuturor utilizatorilor care s-au logat de la ultima initializare a bazei de date)
grep sshd /var/log/messages
fsck -fCV /dev/md1
mount /dev/md1 /mnt
chroot /mnt
lilo (e mai probabil sa aveti grub, care a înlocuit lilo)
exit
umount /mnt
fdisk -l
tail -n 500 /var/log/messages
tail -f /var/log/messages
tail -f /var/log/mail.info
tail -f /var/log/warn
tail -f /var/log/mail.err
tail -f /var/log/mail.warn
tail -f /var/log/apache2/access_log
tail -f /var/log/apache2/error_log
Niciun comentariu:
Trimiteți un comentariu