Scaricare i video da Youtube con Firefox

Posted by Cristian | Posted in Work in progress | Posted on 13-12-2009

0

Grazie al plugin (Fast YouTube Download) è possibile scaricare con un click tutti i video presenti su youtube scegliendo il formato preferito.

plugin-firefox

Sniffare le immagini che circolano in rete con driftnet

Posted by Cristian | Posted in Sniffer | Posted on 12-12-2009

0

Questo tool (driftnet) che è già disponibile tra i repository ufficiali di Ubuntu ci permette di sniffare tutte le immagini che transitano all’interno della rete alla quale siamo collegati.

Basta quindi installarlo da shell con:

sudo apt-get install driftnet

e lanciarlo magari dando prima uno sguardo alle opzioni

sudo driftnet -v

e questo è il risultato

driftnet

ne ho illustrato le funzionalità ma ovviamente ne sconsiglio l’utilizzo.. la privacy è la privacy

w00tw00t.at.ISC.SANS.DFind come bloccarlo

Posted by Cristian | Posted in Apache2, Sicurezza IT | Posted on 12-12-2009

0

Visto che c’è chi ci prova sempre a bucare il nostro website…

[Sun Nov 15 22:39:48 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Sat Nov 21 04:38:59 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Sat Nov 21 05:19:41 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Sat Nov 21 20:49:55 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Wed Nov 25 06:23:15 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Thu Nov 26 04:22:24 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Nov 27 06:23:02 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Nov 27 07:00:35 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Dec 04 08:37:26 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Dec 04 22:20:37 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Tue Dec 08 06:13:16 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Tue Dec 08 11:30:17 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Wed Dec 09 06:32:59 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Dec 11 01:57:56 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Dec 11 05:30:52 2009] [error] [client xxx.xxx.xxx.xxx] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

con questo script molto semplice e ben fatto (trovato gia pronto su internet) è possibile aggiungere in automatico un drop su iptables per bloccare tutti quegli ip che provano a sfruttare Web Vulnerability Scanner tipo DFind, basta copiare il codice evidenziato qui sotto in un file tipo w00tw00t.sh e farlo girare con il cron.

#!/bin/sh
# add iptables drop for w00tw00t scan

for ip in `cat /var/log/apache2/error_log |grep w00tw00t | awk ‘{print $8}’ | sed ‘s/]//g’  | sort -ug` ; do
countoff=$[$countoff+1]
countwoot=$[$countwoot+1]
iptables -I INPUT -s $ip -j DROP
iptables -I OUTPUT -s $ip -j DROP

PHP Warning: …php5/20060613+lfs/mcrypt.so

Posted by Cristian | Posted in Apache2 | Posted on 12-12-2009

0

Questo PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20060613+lfs/mcrypt.so’ su Ubuntu solitamente è dovuto al fatto che apache2 cerca di caricare il modulo mcrypt che non è stato installato e che quindi non viene trovato, basta quindi lanciare da shell:

apt-get install php5-mcrypt

Installare Gnome 3 Shell su Ubuntu 9.10

Posted by Cristian | Posted in Work in progress | Posted on 07-12-2009

0

si mormora che uscirà solo nel settembre del 2010 ma si può già installare
sudo apt-get install gnome-shell

per lanciare Gnome 3 Shell
gnome-shell –replace

Gnome 3 Shell

Come generare un certificato ssl per Apache httpd

Posted by Cristian | Posted in Comandi Shell Linux | Posted on 29-10-2009

0

Per prima cosa creo la chiave:
openssl req -new > new.cert.csr

rimuovo la frase di sicurezza:
openssl rsa -in privkey.pem -out new.cert.key

converto la richiesta nel certificato firmato:
openssl x509 -in new.cert.csr -out new.cert.cert -req -signkey new.cert.key -days 365

faccio il move dei due file nel path che andrò poi ad inserire nel file di configurazione di Apache

edito sul file di configurazione di apache i path ai due file:
vi /etc/httpd/conf/httpd.conf (su RedHat/Centos)

# ..inizio…………………su RedHat/Centos
SSLCertificateFile /etc/httpd/conf/ssl/new.cert.cert
SSLCertificateKeyFile /etc/httpd/conf/ssl/new.cert.key

# ..fine…………………su RedHat/Centos

e reimposto i permessi sui due file (RedHat/Centos):
chmod 400 /etc/httpd/conf/ssl/*

# ..inizio………………… su Debian/Ubuntu *
SSLCertificateFile /etc/apache2/ssl/my.cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/my.key.pem

# ..fine………………… su Debian/Ubuntu

e reimposto i permessi sui due file (Debian/Ubuntu):
chmod 400 /etc/apache2/ssl/*

Come evitare che CTRL-ALT-CANC faccia reboot al nostro sistema linux

Posted by Cristian | Posted in Comandi Shell Linux | Posted on 24-10-2009

0

Nella quasi totalità delle distribuzioni linux, alla pressione simultanea dei tasti CTRL-ALT-CANC (CTRL-ALT-DEL) ha inizio il processo di reboot del sistema anche senza avere nessuna credenziale di accesso al sistema.

Specialmente nei sistemi in produzione, disabilitare quest’impostazione può evitare sgradevoli situazioni.

L’azione che viene eseguita alla pressione simultanea dei tasti CTRL-ALT-CANC è definita nel file /etc/inittab e varia di poco da distribuzione a distribuzione.

Qualche esempio:

su RedHat la riga è questa:
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

su Debian questa:
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

per disabilitare questa azione è sufficiente rimpiazzare la riga con questa:
ca:12345:ctrlaltdel:/bin/echo “CTRL-ALT-DEL disabilitato per il reboot”

dopo aver fatto la modifica basta riavviare init con il comando init q.

Ottenere informazioni sull’HW del pc in uso

Posted by Cristian | Posted in Comandi Shell Linux | Posted on 11-10-2009

0

Due comandi che permettono di ottenere molte informazioni utili sui componenti del computer in uso.
dmidecode e lshw.

Un esempio che mi permette di ottenere informazioni sulla ram e gli slot utilizzati:
dmidecode -t memory
lshw -c memory

Nagios NSClient++ per monitorare server Windows

Posted by Cristian | Posted in Nagios | Posted on 02-10-2009

0

NSClient++ è un agent per server windows disponibile per sistemi X32, X64 ed Itanium che permette a Nagios di eseguire innumerevoli check a servizi, processi e molto altro.

Una volta scaricata dal sito nsclient.org la versione corretta per il vostro sistema ed installata, basta personalizzare il file nsc.ini presente nella directory in cui è stato installato l’agent così da attivare i moduli aggiuntivi necessario ed impostare una password di sicurezza che non è obbligatoria ma a mio avviso vivamente consigliata.

E’ bene anche controllare le impostazioni del servizio che è stato creato NSClientpp e inpostare sul Log On il flag su Local System account e Allow service to interact with desktop.

nsclient

nsclient

Io ho installato una versione un pò vecchia, ho visto che ora c’è la 0.3.7…

Per attivare i moduli basta decommentare le righe associate ai moduli di cui si ha bisogno all’interno del file nsc.ini.

di seguito la parti minime da personalizzare sul file nsc.ini che comunque con l’ultima versione del client dovrebbe poter essere possibile impostare già dalla gui di installazione:

[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;  You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; *                                                               *
; * N O T I C E ! ! ! – Y O U   H A V E   T O   E D I T   T H I S *
; *                                                               *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
;CheckWMI.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll
; NSCA Agent is a new beta module use with care!
NSCAAgent.dll
; LUA script module used to write your own “check deamon” (sort of) early beta.
LUAScript.dll
; Script to check external scripts and/or internal aliases, early beta.
CheckExternalScripts.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)
NRPEClient.dll
; Extreamly early beta of a task-schedule checker
CheckTaskSched.dll

[Settings]
;# OBFUSCATED PASSWORD
;  This is the same as the password option but here you can store the password in an obfuscated manner.
;  *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the
;  password. Its just a bit harder to do it at first glance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;# PASSWORD
;  This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly.
password=
QUI INSERISCO LA PASSWORD A PROTEZIONE DELL’AGENT
;
;# ALLOWED HOST ADDRESSES
;  This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.
;  If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).
;  The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that subnet access
allowed_hosts=
QUI INSERISCO L’IP DEL MIO SERVER NAGIOS
……….

Ora che lato windows abbiamo ultimato la configurazione è necessario definire l’host, i servizi da monitorare ed inserire nei check presenti sul file command.cfg la password messa a protezione del client NSclient installato sul server windows.

Di seguito tutte le definizioni da inserire nei file di configurazione lato Nagios.

Riga da aggiungere nel file degli hosts.cfg (che dovrà essere a sua volta incluso nel file di configurazione di nagios.cfg)

# Definizioni host 192.168.1.101
define host{
host_name                         192.168.1.101
alias                                      192.168.1.101
address                               192.168.1.101
check_command            check-host-alive
check_interval                5
retry_interval                 1
max_check_attempts  5
check_period                  24×7
contact_groups              admins
process_perf_data        0
retain_nonstatus_information    0
notification_interval           30
notification_period             24×7
notification_options           d,u,r
parents                                     192.168.1.1
}

Righe da aggiungere o modificare se già presenti nel file services.cfg

# Create a service for monitoring CPU USAGE
define service{
use                     generic-service
host_name               192.168.1.101
service_description     CPU Load
check_command           check_nt!CPULOAD!-l 5,80,90
}

# Create a service for monitoring ping
define service{
use                     generic-service
host_name               192.168.1.101
service_description     PING
check_command           check-host-alive
}

# Create a service for monitoring MEMORY USAGE
define service{
use                     generic-service
host_name               192.168.1.101
service_description     Memory Usage
check_command           check_nt!MEMUSE!-w 80 -c 90
}

# Create a service for monitoring C:\ disk usage
define service{
use                     generic-service
host_name               192.168.1.101
service_description     C:\ Drive Space
check_command           check_nt!USEDDISKSPACE!-l c -w 85 -c 95
}

# Create a service for monitoring S:\ disk usage
define service{
use                     generic-service
host_name               192.168.1.101
service_description     S:\ Drive Space
check_command           check_nt!USEDDISKSPACE!-l s -w 85 -c 95
}

# Create a service for monitoring sql server connections
define service{
use                     generic-service
host_name               192.168.1.101
service_description     SQL Server connection
check_command           check_nt_sql_server_connections
}

# Create a service for monitoring paging file useage
define service{
use                     generic-service
host_name               192.168.1.101
service_description     Utilizza file paging
check_command           check_nt_paging_file_useage
}

# Create a service for monitoring error logs
define service{
use                     generic-service
host_name               192.168.1.101
service_description     Error logs
check_command           check_nt_logon_errors
}

# Create a service for monitoring W3SVC service
define service{
use                     generic-service
host_name               192.168.1.101
service_description     W3SVC
check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}

# Create a service for monitoring IIS Admin Service
define service{
use                     generic-service
host_name               192.168.1.101
service_description     IIS Admin Service
check_command           check_nt!SERVICESTATE!-d SHOWALL -l IISADMIN
}

# Create a service for monitoring HTTS SSL service
define service{
use                     generic-service
host_name               192.168.1.101
service_description     HTTP SSL
check_command           check_nt!SERVICESTATE!-d SHOWALL -l HTTPFilter
}

# Create a service for monitoring Windows TIME service
define service{
use                     generic-service
host_name               192.168.1.101
service_description     Servizio Windows TIME
check_command           check_nt!SERVICESTATE!-d SHOWALL -l W32Time
}

righe da aggiungere o modificare se già presenti nel file commands.cfg

# ‘check_nt’ command definition
define command{
command_name    check_nt
command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s
PASSWORD INSERITA NEL FILE NSC.INI -v $ARG1$ $ARG2$
}

# ‘check_nt’ command definition per error log
define command{
command_name     check_nt_logon_errors
command_line     $USER1$/check_nt -H $HOSTADDRESS$ -s
PASSWORD INSERITA NEL FILE NSC.INI -p 12489 -v COUNTER -l “\\Server\\Errors Logon”,”Logon Errors since last reboot is %.f” -w 50 -c 150
}

#Paging File Usage
define command{
command_name     check_nt_paging_file_useage
command_line     $USER1$/check_nt -H $HOSTADDRESS$ -s
PASSWORD INSERITA NEL FILE NSC.INI -p 12489 -v COUNTER  -l “\\Paging File(_Total)\\% Usage”,”Paging file usage is %.2f %%” -w 30 -c 60
}

#SQL Server Connections
define command{
command_name     check_nt_sql_server_connections
command_line     $USER1$/check_nt -H $HOSTADDRESS$ -s
PASSWORD INSERITA NEL FILE NSC.INI -p 12489 -v COUNTER -l “\\SQLServer:General Statistics\\User Connections”,”SQL Server Connections are %.f” -w 1500 -c 2000
}

In conclusione una volta installato e configurato NSClient, definito il nuovo host, i nuovi services e i nuovi commands sui rispettivi file di configurazione  richiamati  dal file di configurazione di Nagios basta fare un  /etc/init.d/nagios reload e se non ci sono errori si dovrebbe ottenere qualcosa del genere.

nagios

Installare e configurare NagiosGrapher

Posted by Cristian | Posted in Nagios | Posted on 16-09-2009

2

NagiosGrapher si integra con Nagios e sfruttando rrd permette di popolare dei grafici sull’andamento temporale dei servizi posti sotto monitoraggio, di seguito i passi da seguire per installarlo e configurarlo al meglio su ubuntu server.

nagios-screenshot

Per prima cosa scarico l’ultima versione stabile disponibile dal sito https://www.nagiosforge.org/gf/project/nagiosgrapher/frs/

wget https://www.nagiosforge.org/gf/download/frsrelease/135/285/NagiosGrapher-1.7.1.tar.gz

poi scompatto il tar.gz ed entro nella cartella:
tar xzf NagiosGrapher-1.7.1.tar.gz
cd NagiosGrapher-1.7.1

installo i pacchetti per proseguire nell’installazione di NagiosGrapher:
apt-get install autoconf rrdtool perl perl-base perl-modules libcalendar-simple-perl libgd-gd2-perl perlmagick librrds-perl liburi-perl

e passo all’installazione del pacchetto scaricato prima:
autoconf
./configure
make testdeps
make install
make update

se la procedura si è completata senza errori aggiungo le righe sottostanti al file di configurazione di nagios /usr/local/nagios/etc/nagios.cfg:
# per Nagiosgrapher
cfg_dir=/usr/local/nagios/etc/serviceext
process_performance_data=1
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-file

nelle varie guide disponibili su internet in molti casi viene riportata ‘erroneamente’ questa stringa:
service_perfdata_file_template=$HOSTNAME$ $SERVICEDESC$ $SERVICEOUTPUT$ $SERVICEPERFDATA$ $TIMET$

al posto di questa:
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$
che non permette la generazione e popolazione dei file sotto /usr/local/nagios/var/rrd e la conseguente mancata visualizzazione dei grafici quindi almeno in questa installazione è da evitare se lo si vuol far funzionare

poi aggiungo le righe che seguono al file /usr/local/nagios/etc/objects/commands.cfg:
# per NagiosGrapher
define command{
command_name process-service-perfdata-file
command_line mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/service-perfdata.$TIMET$
}

ora in base ai check che ho attivato attivo anche i grafici corrispondenti, faccio qualche esempio..

se sto monitorando tramite un check_ping la risposta di un host e nel file di configurazione dei servizi (services.cfg) ho definito come service_description PING basterà attivare il file check_ping.ncfg.disabled semplicemente muovendolo in un altro file così come segue:
mv check_ping.ncfg.disabled check_ping.ncfg

ed avviare nagios e nagios_grapher:
/etc/init.d/nagios_grapher start
/etc/init.d/nagios restart

aspettare qualche minuto che si generino in automatico i file di configurazione sotto /usr/local/nagios/etc/serviceext e che si generino e popolino i file in /usr/local/nagios/var/rrd/ e poi riavviare nagios_grapher e far ricaricare la configurazione a nagios:
/etc/init.d/nagios_grapher restart
/etc/init.d/nagios  reload

A questo punto dovrebbe apparire accanto alla descrizione del servizio un’icona cliccabile che permetterà di visualizzare i grafici che mammano verranno popolati.