Archivio

Archivio per la categoria ‘Documenti Tecnici’

keyfinder

3 aprile 2010

ProduKey is a small utility that displays the ProductID and the CD-Key of Microsoft Office (Microsoft Office 2003, Microsoft Office 2007), Windows (Including Windows 7 and Windows Vista), Exchange Server, and SQL Server installed on your computer. You can view this information for your current running operating system, or for another operating system/computer – by using command-line options. This utility can be useful if you lost the product key of your Windows/Office, and you want to reinstall it on your computer.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft

Modalità Xp Mode in windows 7

23 marzo 2010
L'Xp Mode è per tutti
L’Xp Mode è per tutti
Grazie a una nuova patch, gli utenti di Windows 7 Professional, Ultimate ed Enterprise avranno titolo per installare la “XP Mode”, indipendentemente da qualunque requisito hardware.

L’esperienza degli utenti nell’installazione e nell’utilizzo di Windows 7 è senz’altro positiva. Le impressioni non appaiono nemmeno lontanamente paragonabili a quelle registrate dopo il lancio di Windows Vista, poco più di tre anni fa.

Per venire incontro agli utenti ma soprattutto alle aziende che utilizzano software non ancora pienamente compatibili con Windows 7, Microsoft ha messo a disposizione il cosiddetto Windows XP Mode. Si tratta di un componente aggiuntivo, disponibile come pacchetto separato, che permette di eseguire – in versione “virtualizzata” – una copia completa di Windows XP SP3.

Eseguendo Windows XP senza abbandonare Windows 7, servendosi di una macchina virtuale, si possono così avviare ed utilizzare le applicazioni che non fossero risultate pienamente compatibili con il più recente tra i sistemi operativi firmati dal gigante di Redmond. Alla base di “XP Mode” c’è l’impiego della piattaforma “Virtual PC” di Microsoft. Una volta installato l’”add-on” in Windows 7, questo propone all’utente una copia di Windows XP SP3, già preventivamente attivata e dotata di una regolare licenza d’uso.

Fino ad oggi, però, per poter installare “Windows XP Mode”, era necessario verificare che il sistema in uso soddisfacesse alcuni requisiti essenziali. Il personal computer, in particolare, doveva essere dotato di processore con frequenza operativa pari ad almeno 2 GHz e, soprattutto, integrare il supporto alla virtualizzazione x86 (AMD-V oppure Intel VT) – opportunamente attivato a livello BIOS -.

Microsoft ha però deciso di non tagliare più fuori gli utenti precedentemente esclusi dall’utilizzo di “XP Mode”. Mediante l’installazione di un’apposita patch appena rilasciata, gli utenti di Windows 7 Professional, Ultimate ed Enterprise avranno titolo per installare la “XP Mode”, indipendentemente da qualunque requisito hardware. Esclusi dall’operazione, sono i possessori della versione “Home” di Windows 7. Per loro o comunque per chi preferisse orientarsi su soluzioni “alternative”, ci sono software per la virtualizzazione sviluppati da terze parti come VMware Player, VirtualBox o VMLite.

Le patch che “aprono” l’utilizzo di “XP Mode” a tutti sono le seguenti:
Aggiornamento per Windows 7 (KB977206) (per sistemi Windows 7 a 32 bit)
Aggiornamento per Windows 7 per sistemi basati su x64 (KB977206) (per sistemi Windows 7 a 64 bit)

Per procedere al download è necessaria la convalida della “genuinità” della copia di Windows 7 in uso.

  • Share/Bookmark

nnadalca Documenti Tecnici, Microsoft

Backtrack – Sniffare una rete locale per cercare password

7 marzo 2010

Questi appunti mostrano come sia facile intercettare le password che passano attraverso la propria rete locale. Per farlo utilizziamo uno dei programmi distribuiti con Backtrack versione 3 o 4, Ettercap.

Per funzionare è necessario che l’utente che lancia ettercap sia connesso alla rete tramite cavo LAN , collegato sia trmite switch o hub.

La prova è stata fatta sulla mia rete locale, tra due computer che utilizzo esclusivamente io e le password intercettate sono quelle che uso per connettermi ad un servizio di posta elettronica ed ad un sito web di telefonia. L’utilizzo di ettercap per intercettare password o più in generale dati di altri utenti è illegale. Ogni abuso è responsabilità vostra ed è punibile dalla legge. Questi appunti personali sono stati ricavati da guide più complete che si possono trovare su internet. Continuando a leggere vi assumete ogni responsabilità per l’utilizzo che potete fare di queste informazioni.

Questi sono i passi che ho seguito per intercettare le mie  password digitate su un altro computer connesso alla mia rete locale:

  1. Lanciare ettercap dal menù Privilege Escalation
  2. In ettercap: dal menù Sniff>Unified Sniffing> scegliere scheda (nel mio caso eth0)
  3. Fare uno scan di tutti gli host collegati: Ctrl+s
  4. Dal menù Mitm>Arp Poisoning selezionare Sniff Remote Connection
  5. Dal menù Start>start Sniffing
  6. Quando qualcuno fa il login si vede nome utente e password oltre all’indirizzo in cui si logga.
All’utente remoto compare una finestra che lo avvisa che il certificato di sicurezza della pagina è da verificare. Il sistema funziona solo se si accetta il certificato.
Questo procedimento si può utilizzare anche per intercettare dati protetti da cifratura ssl, ma va modificato il file di configurazione di ettercap:
  1. Aprire una console e digitare: nano /usr/local/etc/etter.conf
  2. Cercare le righe:
    # if you use iptables:
    #redir_command_on = “iptables -t nat -A PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”

    #redir_command_off = “iptables -t nat -D PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
  3. Togliere il simbolo # dalle due righe redir_command…..
  4. Salvare e chiudere il file. A questo punto si può avviare ettercap

Il contenuto del file di log di cio’ che e’ stato registrato si puo’ trovare e visualizzare via comando etterlog <nome file> direttamente nella posizione dove e’ stato salvato il file di log.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft, Tutorial ,

Blockcontrol, Filtrare il P2P con Linux

7 marzo 2010

Blockcontrol è un programma per linux simile a peerguardian per windows, permette di bloccare e filtrare le connessioni da e verso agenzie anti P2P, RIAA e MPAA, host dannosi, ecc..

Blockcontrol non è niente di nuovo per linux, è solo il pacchetto moblock-control che è stato rinominato in blockcontrol, comunque, non è un programma molto conosciuto e scrivendo questo post magari ho dato anche una mano a chi cercava moblock-control e non lo trovava, per chi non lo conosce scrivo anche una piccola guida che dice come installarlo.

Blockcontrol non è da scambiare per un firewall è solamente il un filtro per gl’indirizzi IP che si vuole bloccare, per intenderci quelli delle liste di bluetack, però non è un programma come peerguardian per windows anche se l’ho chiamato programma all’inizio del post, assieme ad un’altro software diventa un demone (servizio), però, può anche essere bloccato quando si vuole.

Installare Blockcontrol, almeno da sorgenti non è intuitivo, infatti, oltre le dipendenze richiede anche MoBlock che è il demone vero e proprio, Blockcontrol serve per costruire la lista degl’indirizzi IP che verranno bloccati, e, se si vuole anche un po di comodità bisogna installare anche Mobloquer che è l’interfaccia grafica di Blockcontrol.

Però, ho detto che non è intuitivo installare Blockcontrol, non è difficile, infatti io per installarli bisogna solo scaricare i pacchetti, entrare tramite la shell nelle rispettive directory (una alla volta ovviamente) e si digita make e make install rispettivamente in ogni directory, solo per installare Mobloquer prima bisogna digitare qmake-qt4 (in slackware qmake) prima di make, comunque, per Ubuntu ed altre distro penso che ci siano già i pacchetti, se non ci fossero metto i collegamenti a fine post.

Ricordo infine altre cose banali ma molto importanti, tramite Blockcontrol, oltre a scaricare in sicurezza anche su Linux, senza sbattersi ad aggiornare il filtro IP visto che lo farà automaticamente, si può avere maggiore privacy e qualche decimo di velocità potrebbe guadagnarla anche la connessione, e, visto che si può fare una lista personalizzata è possibile bloccare qualsiasi sito web/server.

Qui potete fare il download di Blockcontrol, qui si può scaricare MoBlock, e qui c’è Mobloquer che è la GUI non è indispensabile ma comoda.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft

Snort come ids

6 marzo 2010

SNORT, il re degli IDS liberi

SNORT è un Network based IDS real-time, leggero, con risposta passiva alle intrusioni e con un’elevata accuratezza nel rilevamento delle intrusioni. Questo IDS ha caratteristiche real-time, in quanto è in continuo ascolto sul segmento di rete a cui è stato assegnato ed è in grado di contattare l’amministratore di sistema attraverso molteplici meccanismi come Syslog. La leggerezza di SNORT dipende da due fattori:

  1. L’efficienza nella scansione dei pacchetti, dal momento che usa poche risorse di sistema;
  2. Le dimensioni dei sorgenti del NIDS.

La semplicità del tool e la sua struttura modulare hanno fatto in modo che non dovesse mai essere reimplementato o modificato per poter identificare nuove tipologie di attacco. Inoltre, la linearità di scrittura delle regole ed il basso livello di rete in cui opera lo rendono uno strumento particolarmente duttile, anche come tool di analisi per attacchi sconosciuti.

SNORT può esaminare i protocolli più diffusi, può individuare una varietà di attacchi e di probes, così come buffer overflow, port scanning, attacchi CGI e probes SMB. Guardando i file di log si riesce a determinare a quale tipo di attacco si è stati soggetti. Ricordate, un uso efficace di meccanismi di logging è fondamentale per la sicurezza del vostro sistema, con o senza IDS.

Altra caratteristica importante di questo NIDS è la portabilità; i sistemi operativi su cui si può installare SNORT sono: Linux, OpenBSD, FreeBSD, NetBSD, Solaris, SunOS 4.1.X, HP-UX, AIX, IRIX, Tru64 (tutti sistemi Unix like), MacOS (su sistemi Macintosh), Win32 (Win9x/NT/XP e 2000). Una volta installato SNORT, si possono scaricare ed installare gratuitamente i file di regole aggiornati regolarmente.

Questi file comprendono tutte le regole per riconoscere una serie di attacchi già noti, ma nessuno vieta di crearvi un proprio file di regole se avete esigenze specifiche. Ultima particolarità, non marginale, di questo IDS è il suo rilascio sotto licenza GNU/GPL, che ha permesso, e permette, ad un nutrito gruppo di sviluppatori di contribuire al suo perfezionamento.

Le regole di SNORT

Una regola è una precisa sequenza di istruzioni che permette di istruire l’IDS, consentendogli così di riconoscere attacchi ed anomalie nella rete. Ogni regola è scritta in un’unica riga, infatti, il parser (cioè il componente che interpreta le regole) di SNORT non è in grado di riconoscere le regole scritte su più righe. Ogni regola è composta da due sezioni distinte:

  1. Header (intestazione);
  2. Options (opzioni).

La prima sezione comprende le azioni delle regole: protocollo, indirizzo IP (di origine e di destinazione) e le informazioni relative alle porte. La seconda sezione, options, contiene invece i messaggi di alert e le informazioni su quali parti dei pacchetti devono essere analizzate per determinare se le regole di azione devono essere eseguite. Esempio di una tipica regola per SNORT è il seguente:

alert tcp any any -> 192.168.61.190/23 (content: "Last login"; msg: "Attenzione: tentativo di connessione via telnet alla macchina!";)

questa regola indica a SNORT di mostrare un messaggio di avvertimento se viene individuato del traffico TCP, proveniente da qualsiasi porta e da qualsiasi IP, che tenti di stabilire una connessione sulla porta 23 all’indirizzo 192.168.61.190. Non è scopo di questo articolo analizzare dettagliatamente la sintassi delle regole di SNORT, ma da questo piccolo esempio si può comprendere la facilità e la flessibilità usata nella creazione delle regole. La genialità di SNORT, quindi, sta proprio nella semplicità della sintassi delle regole; in pochi secondi potete creare regole ad hoc e renderle operative, senza spendere un solo euro.

Modalità operative di SNORT

SNORT è un programma dalla mille risorse, non funziona solo ed esclusivamente come NIDS, può operare in tre diverse modalità:

  1. SNORT come IDS: SNORT può essere posizionato tra il firewall, che controlla una rete, e la linea Internet non sicura, analizzando in questo modo sia il traffico diretto al firewall, sia il traffico nella rete controllata. Il piccolo sistema di firme, di cui è dotato, offre un tool di alerting per gli amministratori quando vengono individuate delle attività sospette;
  2. SNORT come packet sniffer: il programma è capace di ispezionare il carico dei pacchetti sulla rete, decodificando il livello di applicazione di un pacchetto e catalogando il traffico basato su un determinato contenuto di dati;
  3. SNORT come packet logger: SNORT può anche effettuare il log dei pacchetti, da linea di comando, indirizzati ad una specifica macchina inviando direttamente alert a video. Uno dei più grandi vantaggi è che SNORT effettua il logging in formato leggibile.

Installazione di SNORT

Passiamo adesso all’installazione di SNORT. Scaricate l’archivio compresso, dell’ultima versione di SNORT, dal sito del progetto; al momento della stesura dell’articolo è la 2.6.1.5. Assumete l’identità di root e decomprime il pacchetto usando i comandi gzip e tar da linea di comando:

# gzip -d -c snort-2.6.1.5.tar.gz | tar xf -

successivamente, spostatevi nella directory appena creata dalla decompressione del pacchetto:

# cd snort-2.6

ed avviate il comando configure con:

# ./configure

L’operazione eseguita dall’utility configure sarà quella di determinare tutte le caratteristiche e gli attributi del vostro sistema per generare un appropriato Makefile. Una volta terminata la configurazione bisogna compilare i file partendo dalle informazioni raccolte precedentemente con il comando configure; per far questo digitiamo il comando:

# make

infine, per installare i file binari e le guide del programma eseguiamo:

# make install

Tutto qui, come avete visto non c’è nulla di difficile nell’installazione di SNORT. Un ultimo consiglio, anche se lo spazio occupato dall’eseguibile è di pochi bytes, è preferibile installare SNORT su una macchina ad esso dedicata, con nessun altro servizio attivo.

Uso di SNORT

SNORT non è difficile da usare, tuttavia l’uso non è sempre tanto immediato. Il tutto sta nello scegliere, in maniera appropriata, quali parametri dare in input a SNORT per renderlo efficiente.

Figura 1: I comandi di Snort

I  comandi di Snort

Leggendo la guida del NIDS potrete conoscere le tantissime opzioni offerte dal programma (figura 1), ma per comodità riporto un breve elenco delle opzioni più importanti ed usate:

  • -A alert-mode effettua un alert usando uno specifico alert-mode (fast, full, none, unsock). Fast scrive gli alert sul file di alert di default in una singola linea; full scrive gli alert sul file di alert decodificando completamente l’header; none disabilita gli alert; unsock è una modalità che manda gli alert su socket UNIX;
  • -a mostra i pacchetti arp quando vengono decodificati;
  • -b effettua il log dei pacchetti in formato tcpdump;
  • -c “rules-file” usa il file di regole nel percorso indicato in rules-file;
  • -C stampa solamente i caratteri del payload del pacchetto;
  • -d visualizza il livello applicazione dei dati quando mostra i pacchetti;
  • -D esegue SNORT in daemon mode (cioè come demone);
  • -e visualizza l’header dei pacchetti ethernet;
  • -h “home-net” setta la “home network” al valore home-net. Il formato di questo indirizzo è un prefisso di rete più un blocco cidr, come ad es: 192.168.2.0/24;
  • -i “interface” mette in ascolto SNORT sull’interfaccia specificata;
  • -l “log-dir” indirizza i log di SNORT in una directory specifica. Per default è impostato il valore /var/log/snort;
  • -n “packet-count” processa solo un numero di pacchetti pari al valore packet-count ed esce;
  • -N smette di loggare i pacchetti. Il programma continua normalmente a generare gli alert;
  • -o cambia l’ordine in cui le regole sono applicate ai pacchetti. Invece dell’ordine d’inizio applicato nello standard Alert-> Pass-> Log, le regole verranno applicate nell’ordine Pass-> Alert -> Log;
  • -p termina la modalità promiscua di sniffing;
  • -q non visualizza i messaggi e le informazioni di inizializzazione;
  • -r “tcpdump-file” mostra il file tcpdump-file formattato;
  • -s manda messaggi di alert al Syslog;
  • -S “n=v” setta la variabile “n” al valore “v”. Utile per settare il valore di una variabile definita nel file di regole di SNORT con un valore specificato nella linea di comando;
  • -v stampa i pacchetti;
  • -V mostra la versione dell’applicazione ed esce.

SNORT come IDS

Abbiamo parlato di SNORT e visto come installarlo in una Linux box. Ora mettiamoci all’opera.

Figura 2: L’avvio di Snort

L'avvio  di Snort

Per prima cosa (figura 2) avviamo SNORT con le opzioni:

# snort -i -lo -v -d -l log -c /etc/snort.conf

Ora SNORT è attivo e pronto. Dopo aver creato la nostra regola testiamone l’efficienza. Proviamo ad accedere alla macchina, indicata nella nostra regola, usando telnet. Dalla console aperta potrete visualizzare sia il rilevamento dei pacchetti, sia i risultati. In questa occasione abbiamo usato SNORT come IDS passandogli (con l’opzione -c), da linea di comando, il file contenente le regole.

Considerazioni su SNORT

I vantaggi di SNORT sono tanti. Ha una struttura modulare, richiede poco tempo per l’installazione, se ci sono nuovi attacchi l’amministratore può facilmente sviluppare nuove regole per rilevarli ed è estendibile usando i plug-in. Gli svantaggi di SNORT, ovviamente, sono quelli comuni agli IDS basati sul pattern matching. Se volete usare una GUI, per lavorare più agevolmente con SNORT, potete installare http://sguil.sourceforge.net/. Sebbene ancora giovane come progetto questo frontend è davvero molto promettente.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft, Tutorial

LogZilla Installation Guide

4 marzo 2010

Per chi come me ha dovuto mettere in piedi  il logserver per il DPS (Documento programmatico sicurezza) ho deciso di mettere in rete questa guida sommaria su come implementare attraverso software opensource il log server con Ubuntu Server  8.04 e comunque funzionante anche con Ubuntu Server 9.10 ed il software  logzilla che attraverso il database mysql registra ogni collegamento come amministratore ai server Microsoft e/o Linux.

Contents

[hide]

About

This page will help guide you through a standard installation process.

For this demo, I will be using version (v2.9.9o) located at The Google code site

If you’re looking for an install guide for v3.0, go to the Install Guide for LogZilla v3.0.

Name Change

You may have noticed that I’ve started using the name LogZilla.

Moving forward, the php-syslog-ng application will be changing it’s name to LogZilla in order to facilitate future plans of moving to an Ajax front-end.

Obtaining LogZilla

Sudo to root and then change directories to your web root(we’ll want to do most of this as root, so su first):

sudo su -
cd /var/www

Download: Grab the latest package from The Google code site and use wget to download it to your local system:

wget http://php-syslog-ng.googlecode.com/files/logzilla_v2.9.9n.tgz

Extract:

 tar xzvf logzilla_v2.9.9n.tgz

Rename the php-syslog-ng directory to logzilla (see #Name_Change)

mv php-syslog-ng logzilla

Make sure you have your log directory created for system logs:

mkdir -p /var/log/logzilla

Requirements

Please note that you should have a decent understanding of Linux, Apache, Mysql and PHP before attempting to use this software. I’ve made every attempt to make it as easy as possible, but due to the nature of this stuff, it does require a decent skill base to implement and operate properly.

The following tools/software must be installed in order to use Php-Syslog-NG:

Syslog-ng

This logging system is based on data collected from a program called Syslog-NG which is “is an open source implementation of the Syslog protocol for UNIX and UNIX-like systems. It extends the original syslogd model with content-based filtering, rich filtering capabilities, flexible configuration options and adds important features to syslog, like using TCP for transport.”

In the case of LogZilla, we’re going to use it to collect syslog messages from our network and store the information into a MySQL database for reporting capabilities.

Here’s a simple diagram of how these pieces fit together: Image:DB_Inserts.jpg

Installing syslog-ng

This section covers syslog-ng using Ubuntu, if you use a different distro you’re on your own…

From a console, type:

sudo aptitude install syslog-ng

You will likely see an error in ubuntu like this:

Remove the following packages:
ubuntu-minimal

It’s a bug in Ubuntu and it’s safe to continue.

Once the syslog-ng installation completes, modify /etc/syslog-ng/syslog-ng.conf and add the following lines to the bottom:

NOTE: a copy of this config file is located under scripts/contrib/system_configs

#
# http://nms.gdd.net/index.php/LogZilla_Installation_Guide#Installing_syslog-ng
# This config works with v2.x of syslog-ng, you will need to make a few changes to make it work with v3.x
# for v3.x - change the following entries in your syslog-ng config:
# Change:
# source(s_all);
# to:
# source(s_local);
# source(s_net);
# destination(d_logzilla);
#
# http://www.syslog.org/syslog-ng/v2/
# modify /etc/syslog-ng/syslog-ng.conf and add the following lines to the bottom:
###########################################################################################
# Clay's LogZilla config below
###########################################################################################
# July 20, 2009 Added by cdukes for LogZilla
###########################################################################################
options {
      long_hostnames(off);
      # doesn't actually help on Solaris, log(3) truncates at 1024 chars
      log_msg_size(8192);
      # buffer just a little for performance
      # sync(1); <- Deprecated - use flush_lines() instead
      flush_lines(1);
      # memory is cheap, buffer messages unable to write (like to loghost)
      log_fifo_size(16384);
      # Hosts we don't want syslog from
      #bad_hostname("^(ctld.|cmd|tmd|last)$");
      # The time to wait before a dead connection is reestablished (seconds)
      time_reopen(60);
      #Use DNS so that our good names are used, not hostnames
      use_dns(yes);
      dns_cache(yes);
      #Use the whole DNS name
      use_fqdn(yes);
      keep_hostname(yes);
      chain_hostnames(no);
      #Read permission for everyone
      perm(0644);
      # The default action of syslog-ng 1.6.0 is to log a STATS line
      # to the file every 10 minutes.  That's pretty ugly after a while.
      # Change it to every 12 hours so you get a nice daily update of
      # # how many messages syslog-ng missed (0).
      # stats(43200);
  };
# Create destination to LogZilla
destination d_logzilla {
  program("/var/www/logzilla/scripts/db_insert.pl"
  template("$HOST\t$FACILITY\t$PRIORITY\t$LEVEL\t$TAG\t$YEAR-$MONTH-$DAY\t$HOUR:$MIN:$SEC\t$PROGRAM\t$MSG\n")
  );
};
# Tell syslog-ng to log to our new destination
log {
  source(s_all);
  destination(d_logzilla);
};
# Clay's LogZilla config above
###########################################################################################

Also, the default syslog-ng installation on Ubuntu has UDP disabled by default, so be sure to change this:

# udp();

To this:

udp();

Somewhere around line 93 of the file…

Note: Change the paths above to reflect your actual installation path!

Installing All Prerequisites

We’ll need to install:

  • Apache
  • PHP
  • MySQL
  • php-gd (for graphs)
  • php-cli for (for command line scripts)
  • php5-mysql
  • msttcorefonts (for graph fonts)
  • build-essential (you’ll need this later for building perl modules and other system stuff)

so type:

sudo aptitude install apache2 php5 php5-gd php5-cli php5-mysql mysql-server msttcorefonts build-essential

From the command line to install everything at once.

(Yes, it’s that easy – see why I like Ubuntu?)

You will also need to install the LevenshteinXS perl module in order to use this version.

To install LevenshteinXS from the CPAN archive, simply type:

sudo cpan Text::LevenshteinXS

Apache

Naturally, if we’re going to use a web interface, we’ll need a web server :-)
First, edit the /etc/apache2/apache2.conf file and add a ServerName directive

sudo vi /etc/apache2/apache2.conf

When you’re done, it should look like this (replace logzilla with your server’s name):

ServerRoot "/etc/apache2" <<- Existing line
ServerName logzilla
Replace 'logzilla' with your actual server name

Note: You can skip the following section if you are installing to the root web server.

Not all systems will need to use the following config. This is only provided as an example.
Next, create a file in /etc/apache2/sites-available called “logzilla” and add the following to it:

# LogZilla
   Alias /logs "/var/www/logzilla/html/"
   <Directory "/var/www/logzilla/html/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
   Order allow,deny
   Allow from all
   </Directory>

Note: AllowOverride should be set to “All” so we can modify php variables using a .htaccess file (more on that later)
Now save this file in the appropriate location. For Ubuntu users, it would be saved as:

/etc/apache2/sites-available/logzilla

Then, for Ubuntu, you would type:

a2ensite logzilla

If you are on a distro other than Ubuntu, you’ll have to look up the documentation to see how to implement this (you might be able to simply add it to the default config file)

Now restart Apache and make sure you don’t see any errors.

 sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                                                               [ OK ]

Finally, go browse to http://<ipaddress>/<directory> and see if it’s working…

MySQL

LogZilla is designed to work with Mysql v5.x

It may work fine with older versions, but I’m not sure so stick with 5.x when possible.

You shouldn’t have to do anything from the command line for installing MySQL other than what we did in the prerequisites section.

All table modifications will be made for you during the LogZilla install.

PHP

This section covers PHP using Ubuntu, if you use a different distro you’re on your own…

LogZilla is designed to work with PHPv5.x

If you are using PHP v4, and plan to use the CEMDB (Cisco Error Message Database), then you will need to convert the CEMDB.class file to an older format as noted in the issues list on the code site:

http://code.google.com/p/php-syslog-ng/issues/detail?id=13&can=1&q=cemdb

If you don’t, you will get errors like this:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or
T_FUNCTION or T_VAR or '}' in
/var/www/php-syslog-ng/includes/CEMDB.class.php on line 11

After you’ve installed everything as noted in the prerequisites section above, edit the /etc/php5/apache2/php.ini file and change a few settings that we’ll need during the web portion:

sudo vi /etc/php5/apache2/php.ini

Change:

memory_limit = 16M

to:

memory_limit = 128M

Change:

max_execution_time = 30

to:

max_execution_time = 300

You should also do the same for /etc/php5/cli/php.ini
Don’t forget to restart apache to start using PHP

 sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                                                               [ OK ]

PERL

Perl is used for some backend functions – most of these files are located in the scripts/ directory.

It’s important that you have a working copy of perl installed.

If you’re using a minimal Ubuntu system and you want to run the dbgen.pl script (to populate the database with some sample data), you might need to add Digest::SHA1 and Net::MySQL PERL modules to the default installation.

See the DBGen section for more details.

Permissions

Make sure you set the html/ directory to the apache web owner.

For example, in Ubuntu you would do:

chown -R www-data:www-data /var/www/logzilla/html

Misc Requirements

While not absolutely necessary to have a working system, the following tools/programs should be added for maintaining your operating system:

Logrotate

A sample logrotate.d script is included in the scripts/contrib/system_configs/ directory which should (depending in your distro) be placed in /etc/logrotate.d

The file contents should be similar to:

# http://nms.gdd.net/index.php/LogZilla_Installation_Guide#Logrotate
# LogZilla logrotate snippet for Ubuntu Linux
# contributed by Clayton Dukes
#
/var/log/logzilla/*.log {
  missingok
  compress
  rotate 5
  daily
  postrotate
  /etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
  endscript
}

Note, again, that you will want to be sure you’ve created the directories used to store log data:

(you can skip this step if you already did it before)

mkdir -p /var/log/logzilla

Cron

Cron is used for regular data maintenance, the following entries should be made in root’s crontab by typing

crontab -e

as the root user on your system

# http://nms.gdd.net/index.php/LogZilla_Installation_Guide#Cron
# LogZilla
@daily php /var/www/logzilla/scripts/logrotate.php >> /var/log/logzilla/logrotate.log
@daily find /var/www/logzilla/html/jpcache/ -atime 1 -exec rm -f '{}' ';'
0,5,10,15,20,25,30,35,40,45,50,55 * * * * php /var/www/logzilla/scripts/reloadcache.php >> /var/log/logzilla/reloadcache.log
# Demo LogZilla
# CHANGE TO MATCH YOUR DIRECTORY PATHS
# @hourly /var/www/logzilla/scripts/dbgen.pl >> /var/log/logzilla/dbgen.log

Advanced Features

This section covers advanced options for implementation

Authentication Methods

Some alternate authentication methods are available which include:

LDAP

To enable LDAP, simply edit the config.php file located in config/ after the install is complete and set the following variables:

define('LDAP_ENABLE', "NO");
define('LDAP_SRV', "ldap.company.com");
define('LDAP_BASE_DN', "ou=active, ou=employees, ou=people, o=company.com");
define('LDAP_CN', "uid");

MS AD

To enable MS Active Directory, simply edit the config.php file located in config/ after the install is complete and set the following variables:

define('LDAP_MSAD', "NO");
define('LDAP_DOMAIN', "mydomain.com");

Web Basic Auth (htaccess)

To enable htaccess support using mod_auth_krb5, simply edit the config.php file located in config/ after the install is complete and set the following variables:

define('WEBBASIC_ENABLE', FALSE);

Note that you will still need to add the appropriate user to the MySQL database before this will work.

For assistance with setting up apache .htaccess, please visit http://home.golden.net/htaccess.html

For more information on this feature, please visit http://code.google.com/p/php-syslog-ng/issues/detail?id=62

Squeeze

Squeeze is a de-duplication feature of LogZilla. It works great, but has some caveats that you should be aware of prior to using it.

Squeeze uses an algorithm similar to Levenshtein’s and is used to compare the number

of “edits” it would take to make each of the compared strings become the same.

The result is displayed as a “distance” (a variable you can alter in the config.php file)

This allows LogZilla to compare incoming messages to those stored in the database.

When a message arrives, SQZ will check the incoming message and compare that to messages in the database that are from the same:

  • host
  • facility
  • priority
  • level
  • tag
  • within the last X minutes (this window is configurable in config.php)

If rows in the database are found to match the incoming message, the Squeeze function will update the original row

with a new “First Occurrence”, “Last Occurrence” and “Count” to reflect the new information and will discard

the incoming message and any other duplicates in the database it finds (within the specified time range).

Caveats

  1. If your company has to comply to PCI standards, then de-duplication is not for you (you may, however, consider

splitting up messages to two separate servers, one for analyzing and reporting, and one for storing ALL messages for PCI records)

  1. If you are getting a lot of messages per day (millions), de-duplication may actualy be too slow for you to use since it

has to do table lookups for each incoming message.

I would encourage you to at least test it though as it does provide some major advantages.

Advantages

Enabling the Squeeze feature allows you to save important DB storage space to allow for much faster analyzation and reporting.

For example, a recent analysis of a customer of mine had the following in just 5 days worth of logs:

  • There were 675 Hosts with a total of 675109 messages.
  • Of the 675109 messages, 99.84% were duplicates
  • Their Top 10 reporting devices had more than 25,000 single messages repeated – the top device had almost 60,000.

This means that if they were de-duplicating events before they got stored into the Syslog server’s database,

then only 2846 rows would be used in that database instead of 675109 individual rows.

The benefits here should be obvious…searching across 3,000 rows is a lot faster then searching through 700,000…
Before implementing this feature, please be aware of the potential damage you can do (i.e. deleted rows).

I encourage you to read more about it here

DBGen

The dbgen.pl file located in the scripts/contrib/dbgen/ directory is used to generate random fake events for testing.

This file can be used to test whether or not LogZilla is working without having syslog-ng installed. It’s written in PERL and you may need to install a couple of modules in order for it to work properly.

Generate a few fake events to verify that the LogZilla part works:

sudo perl /var/www/logzilla/scripts/contrib/dbgen/dbgen.pl

I got an error on my system:

Can't locate Net/MySQL.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib
/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /var/www/logzilla/scripts/contrib/dbgen/dbgen.pl line 22.
BEGIN failed--compilation aborted at /var/www/logzilla/scripts/contrib/dbgen/dbgen.pl line 22.

Which means I don’t have the proper perl libraries installed, so I used cpan:

cpan -i Digest::SHA1 (required to install Net::MySQL)
cpan -i Net::MySQL

NOTE: If you get a make error, you probably have a new system and haven’t installed the Ubuntu build-essentials package.

sudo apt-get install build-essential

Now try dbgen.pl again:

sudo perl /var/www/logzilla/scripts/contrib/dbgen/dbgen.pl

And viola’

Debug off, showing only inserted data...
Host: server-5
Facility: authpriv
Priority: debug
Level: alert
Tag: Tag
YMDHMS: 2008-05-10 21:42:38
Program: DBGen
Message: DBGen: %FABRIC-5-FABRIC_MODULE_ACTIVE: Module 3 is online
Affected row: 1

Now check your url to see the entries:

http://<url>

Logreplay

I’ve included a new in script in version 2.9.9 that will allow you to “replay” a log file taken from another server. The script is located in:

  • /var/www/logzilla/scripts/contrib/logreplay/logreplay.pl

To use the sample logs included simply un-gzip it:

gzip -d syslog.sample.gz

And run the logreplay script:

./logreplay.pl -h

Which will give you help on the script:

This program is used to replay a standard *Cisco* syslog dumpfile into the local syslog receiver (syslog-ng)
       usage: ./logreplay.pl [-hvfs]
       -h        : this (help) message
       -v        : verbose output
       -f        : Filename to import (required)
       -s        : path to the spoof program (required)
       example: ./logreplay.pl -v -f ./syslog.sample -s ./spoof

So, to run it, you would do:

./logreplay.pl -v -f ./syslog.sample -s ./spoof

The “spoof” program that I’ve included will rewrite the outgoing syslog packet and insert the hostnames

from the syslog.sample file so that when syslog-ng receives the messages they appear to come from that host instead of your local machine.

I did not include the source code for “spoof” in the distribution because it could be used maliciously by bad people to insert fake events into other systems.

If you want a copy of the source, please email me and explain why you’d like to have it and I’ll be happy to send it to you.

Installation Process

This section will guide you through a step-by-step installation process, the end of the section includes screencasts so that you can get an idea of how it should work if things go wrong :-)

NOTE: Before starting this process, be sure you’ve completed the items listed in the #Requirements section.

Web-based Install

Make sure everything on the pre-installation check screen is green, if not, fix it before continuing!

Screen 1: Click Next at the top right to begin install

Image:Install001_pre-install-checklist.png
Screen 2: Accept the license agreement and click next

Image:Install002.png

Screen 3: Enter the mysql ROOT user’s password Leave everything else as default unless you really need to change something. (You may want to uncheck the “install sample data” box) Click Next to continue:

Image:Install003.png
Click ok to accept the notice and continue…

Image:Install004.png
Screen 4: Enter a site name, eg: “My Syslog Server” and click Next

Image:Install005.png

Screen 5: Leave the default fields as is unless necessary. You may need to change the ‘Site URL to something like /logs/ Enter email address into email field Enter a password for the local admin acount or leave the random one there (but write it down so you can get into the site later!) When you’re done, click next

Image:Install006.png
Screen 6: If you opted to install the CEMDB, then you will be presented with the following screen:

Image:Install007.png

click Install CEMDB to continue…

special note for Internet Explorer users: 2 people have reported that this button (Install CEMDB) does not work for them. You will need to use Firefox in order to make it work, or manually import the sql data from the command line. Sorry, maybe someday MS will decide to make a standards-based browser, or someone will fix this incompatibility :-)

If you need to, installing the CEMDB data from the command line is very easy.

Once you’ve completed the steps above, if clicking on the Install CEMDB button doesn’t work:

mysql -usyslogadmin -psyslogadmin syslog < /var/www/logzilla/html/install/sql/cemdb.sql

Be sure to replace “syslogadmin” and “syslog” with your username, password and database name.
Assuming the button works as expected, you should now see a page that looks like the following: Click the “Start Import” link to begin inserting CEMDB data into the database.

Image:Install008.png

Once it completes, click on “Continue” near the bottom.

Image:Install009.png

Once you click continue, you should be at the main login screen:

Image:Install010.png
Main Site: Login using admin and the password you selected on screen 5

If you installed the sample data there will be a couple of entries, if not, you’ll get an error message like this:

Image:Install011.png

Not to worry, that error just means that log messages have yet to arrive in the database.

This concludes the Web based portion of the install, hooray!

Console Portion (part 2)

After the web-based install is completed, you will need to modify the paths set in some of the scripts in the scripts/ directory, so run the following script:

cd /var/www/logzilla/scripts
./fixpaths.sh

This script will automatically update all paths for files located in your logzilla directory.

Screencasts

This screencast walks through a normal installation of the Web-based portion of the install:

http://www.youtube.com/watch?v=Q99ovrHWzsE

Caveats

If you get an error running logrotate.php that looks like this:

Query failed: DROP,ALTER command denied to user 'syslogadmin'@'localhost'

Then try running this in mysql:

USE mysql;
update user set Drop_priv='Y',Alter_priv='Y' where User='syslogadmin';
FLUSH PRIVILEGES;

Please note, that because there are many changes in this release, I would highly recommend that you start with a fresh install. If you need to leave your old server running in parallel, please do that rather than trying to upgrade if you can.

Upgrade Procedures

If I *had* to, here’s the method I use to upgrade my servers:
1. Rename the current directory to .old

mv logzilla logzilla.old

2. Untar the new one

tar xzvf php-syslog-ng.<ver>.tgz

3. Get a backup of your whole syslog DB in case something goes wrong:

mysqldump syslog > syslog.sql

5. Get a text listing of all your current log tables

echo "show tables" | mysql syslog | grep "^logs" > list

6. Dump a sql file for each log table in the “list” file created in step 5

for table in `cat list`; do mysqldump syslog $table > $table.sql; done

7. Do a fresh install and tell it to drop the old database

8. Verify that new install works properly

9. Import old data

for t in `ls logs*.sql`; do mysql syslog < $t ; done

Verify everything works as expected. If something blows up, you can always just import your original syslog.sql file :-)

Special note:

Some versions are incompatible with old releases so this method may not work for you.

This is the case with v2.9.9 – I’ve made several changes to the table structures in this version so following the method outlined above will not work.

I would highly recommend you just install the new version and leave the old one running until you no longer require the data in it.

Appendix/FAQ

If you ever need to reset the admin password, you can do it from a mysql shell:

update users set pwhash=md5('MYNEWPASSWORD') where username='admin';
  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft, Tutorial ,

Un Firewall con PfSense

2 marzo 2010

pfSense è una distribuzione firewall basata su FreeBSD (pfSense deriva da m0n0wall, che è basato su FreeBSD).

    Rispetto a IpCop, che consentiva anche a persone senza nozioni di configurazioni di rete di creare un firewall, pfSense richiede un minimo di conoscenza sull’argomento configurazione reti.

    Caratteristiche tecniche di pfSense

    Come si può evincere dal nome, pfSense usa l’ottima implementazione firewall pf (importata da OpenBSD[3]). Tra le sue principali caratteristiche, ha la possibilità di agire da captive portal, ossia da un sistema di monitoraggio degli accessi Wi-Fi in luoghi pubblici o come server DHCP, DNS e PPPoE, di effettuare limitazione di banda e di essere di supporto a numerosi tipi di VPN, come PPTP, IPSEC e per ultima, ma non meno importante, a OpenVPN. Tra le caratteristiche più importanti che si possono evidenziare, ci sono il supporto a CARP e pfSync, che consentono di creare cluster di firewall e inoltre che pfSense supporta più di una connessione ad internet, con la possibilità quindi di bilanciare il carico.

    Tutto questo però ha un prezzo: pfSense infatti necessita di almeno 128 MB di RAM per rendere al meglio le proprie potenzialità.

    Cosa faremo

    In seguito vedremo come configurare il nostro firewall per fare NAT verso internet dei client LAN e per rendere pubblici dei servizi disponibili in alcuni server posizionati in DMZ.

    Per realizzare il firewall sarà quindi necessario un elaboratore con tre interfacce di rete: una per il lato WAN, una per la LAN e una per la DMZ.

    La nostra rete

    Immaginiamo che la nostra rete sia così composta:

    [Schema di Rete]

    Sottoreti:

  • router-firewall: 195.135.12.0/30 (IP disponibili: 195.135.12.1 e 195.135.12.2. Ipotizziamo il primo per il router e il secondo per l’interfaccia internet del nostro firewall)
  • DMZ: 138.122.45.8/29 (IP disponibili: 138.122.45.9 e 138.122.45.14. Ipotizziamo che l’ultimo IP sia disponibile per l’interfaccia DMZ del firewall)
  • LAN: classe privata 192.168.1.0/24 (IP disponibili: 192.168.1.1 e 192.168.1.254, ipotizziamo il primo IP disponibile sia per l’interfaccia LAN del firewall)

Installazione

Prima di procedere con l’installazione, assicuriamoci che il disco che vogliamo utilizzare non contenga dati importanti, poiché in seguito dovrà essere formattato.

Sul sito di pfSense cerchiamo l’immagine ISO del CD. Dopo averla trovata e masterizzata saremo pronti per iniziare l’installazione.

Avvio del CD

Assicuriamoci innanzitutto di aver abilitato il boot con avvio da CD. A questo punto inseriamo nel computer il CD che fungerà da firewall. Comparirà una schermata simile alla seguente:

Possiamo attendere il timeout del timer o premere il tasto “1″. Dopo il caricamento del kernel FreeBSD verrà fatta partire un’istanza di pfSense da CD.

Sta per iniziare la prima configurazione del nostro firewall.

Viene mostrato un elenco delle schede di rete disponibili, e ci viene chiesto se si vuole eseguire la configurazione delle VLAN adesso (“Do you want to setup VLAN now?”). Questo perché è possibile fare in modo che un interfaccia del nostro firewall sia disponile su più VLAN, ovviamente previa opportuna configurazione di switch con supporto VLAN. Se si dovesse decidere di non utilizzare VLAN digitare n, a seguire INVIO (opzione valida nella maggior parte dei casi).

Essendo pfSense basata su FreeBSD, la nomenclatura delle interfacce di rete è un po’ diversa rispetto ai sistemi GNU/Linux. Mentre su Linux le interfacce di rete vengono nominate come eth0, eth1, ethX qualsiasi sia il tipo di scheda, sui sistemi *BSD il nome di un’interfaccia di rete dipende dal driver utilizzato.

Ad esempio: nella schermata catturata durante l’installazione si notano le interfacce di rete ed0, ed1, ed2 che utilizzano il driver “ed”, per schede di rete NE2000, SMC Ultra, 3c503, DS8390 .

È possibile trovare tutte le interfacce supportate (ed i loro nomi) nel FreeBSD Handbook[3] all’indirizzo web http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html.

A questo punto ci verrà chiesto quale tra le interfacce di rete precedentemente visualizzate dovrà essere usata per collegare la rete LAN. Digitare quindi il nome dell’interfaccia (in questo caso “ed0″) e a seguire INVIO.

Successivamente verrà chiesto quale dovrà essere l’interfaccia per il collegamento a internet (collegamento al router/modem ethernet) (WAN), nel nostro esempio “ed1″. Digitiamo il nome dell’interfaccia e a seguire INVIO.

Nella prossima schermata la richiesta sarà se si desidera configurare delle ulteriori interfacce di rete. Si vuole configurare anche l’interfaccia per la DMZ? Inseriamo quindi il nome dell’interfaccia (ed2) e a seguire, INVIO. Se non si dispone di ulteriori interfacce di rete è sufficiente premere INVIO alla successiva domanda “Enter the optional interface name…”.

A questo punto verrà presentato un riassunto delle associazioni delle schede di rete. Se il tutto soddisfa le vostre esigenze è necessario digitare “y”, seguito da INVIO.

Verrà completata l’inizializzazione del sistema. Se il vostro router non utilizza le indicazioni da server DHCP, la configurazione dell’interfaccia WAN potrebbe richiedere un po’ di tempo, questo perché lo stesso cercherà le informazioni necessarie di un indirizzo IP dinamico.

Nota bene: se disponete di una serie di IP statici (come si presuppone in questo articolo) dovrete configurare il vostro router perché conduca le richieste per la sottorete della DMZ verso il firewall.

Installazione su hard disk

Al termine dell’inizializzazione del sistema verrà prospettato un menù. Per installare il sistema su hard disk digitare “99″.

Verrà avviata la procedura di installazione. ATTENZIONE: con il percorso qui descritto, l’intero contenuto del disco verrà formattato e quindi tutti i dati cancellati.

Comparirà una schermata simile a questa.

Posizioniamoci con l’utilizzo del tasto tab su <Accept these Settings>, a seguire INVIO. Sulla successiva schermata selezioniamo <Install pfSense> e premiamo il tasto INVIO.

Ci verrà ora chiesto su quale hard disk installare pfSense. Selezioniamo il disco sul quale vogliamo installare il sistema e a seguire digitiamo INVIO.

La schermata che apparirà sarà la seguente.

Se il disco non è mai stato utilizzato per un firewall pfSense, scegliamo <Format this Disk>, e a seguire digitiamo INVIO.

Verrà presentata la geometria del disco rilevata.

Se è corretta posizioniamoci su <Use this Geometry> e a seguire premiamo INVIO.

Ci verrà ora chiesta l’ultima conferma per la formattazione del disco. Selezioniamo <Format …> e digitiamo il tasto INVIO.

Il sistema ci chiederà se vogliamo partizionare il disco. Se desideriamo che tutto il disco del nostro firewall sia dedicato a pfSense, scegliamo <Skip this Step>, a seguire INVIO.

Ci verrà chiesto di installare il blocco di boot:

selezioniamo <Accept and Install Bootblocks> e a seguire premiamo INVIO.

La schermata successiva riguarderà la creazione di alcune sottopartizioni (root e swap):

Possiamo accettare le scelte di default selezionando <Accept and Create> (a seguire di nuovo INVIO).

Ora tutti i file verranno copiati. Al termine del processo di copia possiamo effettuare il reboot del computer. Al riavvio assicuriamoci che il CD non sia più nel lettore.

Primo avvio

Dopo aver effettuato l’avvio senza CD-ROM verrà avviata un’istanza di pfSense dal disco fisso. Quando vedremo comparire il menù di configurazione testuale significherà che il sistema è stato avviato.

Come possiamo vedere all’interfaccia LAN è stato assegnato di default l’indirizzo 192.168.1.1

Configurazione del firewall

pfSense mette a disposizione un’ottima interfaccia web per la sua configurazione. È possibile raggiungere l’interfaccia di configurazione andando a visionare il sito web all’indirizzo http://192.168.1.1 e inserendo come nome utente admin e come password pfsense.

Dai vari menù sarà ora possibile configurare tutte le impostazioni del vostro nuovo firewall.

Iniziamo subito, cambiando le impostazioni di base del firewall. Posizioniamoci sul menù alla voce “System -> General Setup”.

Cambiamo ora l’hostname del firewall, il dominio e il server DNS da utilizzare. Possiamo anche decidere di mettere in ascolto l’interfaccia di amministrazione web solo su https, in modo che lo scambio di informazioni avvenga in modo cifrato.

Sarebbe meglio anche cambiare la password per l’accesso all’interfaccia di amministrazione, scegliendone una più sicura di quella di default.

A questo punto clicchiamo quindi su save per salvare le informazioni inserite.

Procediamo ora ad assegnare gli indirizzi IP alle schede della WAN e della DMZ. Cominciamo con la WAN, quindi posizioniamoci sul menù fino a raggiungere la voce “Interfaces->WAN”.

Come “Type” selezionare “Static”. Inseriamo ora l’indirizzo IP, bit della maschera di rete e gateway di default (in questo esempio: 195.135.12.2, 30, 195.135.12.1).

Clicchiamo quindi su save per salvare le impostazioni.

Procediamo quindi a configurare l’interfaccia DMZ, andando su “Interfaces->OPT1″.

Selezioniamo “Enable Optional 1 interface” per abilitare l’interfaccia e gli assegnamogli un nome più user-friendly, ad esempio DMZ. Possiamo ora inserire l’indirizzo IP e maschera di rete, in questo esempio 138.122.45.14 e 29 (255.255.255.248).

Prima di impostare le opportune regole di firewalling configuriamo qualche servizio per la rete LAN.

Possiamo impostare il nostro firewall perché funga da piccolo server DNS/DNS forwarder, semplicemente andando su “Services->DNS”. Sarà anche possibile configurare il servizio DHCP per la LAN andando su “Services->DHCP Server”.

Possiamo procedere ora a configurare le nostre regole di filtraggio di base. Andiamo su “Firewall->Rules” (il NAT per la LAN e’ abilitato di default).

NOTA: Una sicurezza in più per gli host presenti in DMZ può consistere nell’abilitare in uscita dalla DMZ stessa solo i servizi necessari, ad esempio porta 25 verso qualsiasi host e porta 80 solo verso server per gli aggiornamenti dei pacchetti; tutto dovrà risultare bloccato. Questo per evitare che un attaccante possa sfruttare una vulnerabilità dei nostri server per scaricare qualcosa da internet ed eseguirlo.

Procediamo quindi ricordandoci la nota precedente. Clicchiamo sulla tab DMZ per gestire i pacchetti in ingresso da quell’interfaccia, ed aggiungiamo quindi la regola che consenta al nostro server di posta (138.122.45.10) di connettersi alla porta 25 di qualsiasi host. Successivamente consentiamo ai nostri server di connettersi via http all’host 62.90.12.193 (ipotizziamo che sia l’host per gli aggiornamenti dei pacchetti dei nostri server).

Per applicare le modifiche dalla pagina che elenca tutte le regole clicchiamo su “Apply changes”.

Decidiamo ora quali servizi debbano essere disponibili nella nostra DMZ: portiamoci nella tab WAN per gestire i servizi accessibili dalla WAN (utilizzare la tab LAN per gestire i servizi visibili dalla LAN)

Consentiamo l’accesso alla porta SMTP del nostro server di posta, dopodiché configuriamo tutti i servizi sull’esempio di questo.

Ricordiamoci sempre di applicare le modifiche al termine della configurazione.

Ecco fatto, il nostro firewall e’ pronto e servito.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft, Tutorial

netsh.exe e le configurazioni di rete

28 febbraio 2010

All’interno di Windows 2000 e Windows XP c’è un utilità molto comoda, si tratta di netsh.exe.
Con netsh.exe potete fare molte cose una di queste è appunto configurare le interfacce di rete.
Se prova a lanciare netsh.exe vedrete apparire un prompt particolare netsh>.
Il funzionamento è simile alla configurazione di un router, cioè ci sono vari “Contesti” e “Sottocontesti” a cui potete accedere come per esempio “Routing” o “Interface” e così via, a cui poi corrispondono varie funzionalità.

Utilizzeremo netsh.exe con uno script di configurazione. Chiaramente per ogni rete o ufficio che visitate avrete un diverso file di script. Per lanciare netsh usando uno script dovete usare questa sintassi:

netsh exec script.txt

ed ora vediamo due esempi di script:

Assegnamento automatico dei parametri alla scheda di rete tramite DHCP

interface
ip
set address name=”Connessione alla rete locale (LAN)” source=dhcp
set dns name=”Connessione alla rete locale (LAN)” source=dhcp
quit

Questo è il codice che dovete inserire nel vostro file script.txt. Come vedete viene assegnato il source=dhcp sia al gruppo address (IP,Netmask,Gateway) sia al gruppo dns (DNS primario e secondario). Naturalmente “Connessione alla rete locale (LAN)” dev’essere sostituito con il nome della vostra connessione.

Assegnamento manuale dei parametri alla scheda di rete

interface
ip
set address name=”Connessione alla rete locale (LAN)” source=static addr=192.168.1.2 gateway=192.168.1.1 mask=255.255.255.0 gwmetric=0
set dns name=”Connessione alla rete locale (LAN)” source=static addr=212.31.224.5 register=primary
add dns name=”Connessione alla rete locale (LAN)” addr=81.88.224.130
quit

Anche in questo caso è molto semplice, come vedete c’è il nome della connessione e i vari parametri che naturalmente dovete modificare in base alle vostre esigenze.
C’è anche l’impostazione del DNS primario e l’aggiunta di un DNS secondario.

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft, Tutorial

[Mac OSx86] 10.4.8 VMware Installation Guide

24 febbraio 2010

how_to___leopard_on_vmware_by_bush1do

Description:

Try out Mac OS X 10.4.8 for yourself without buying a real mac. Let this guide help you along the way with simple, easy to understand step-by-step instructions and screenshots. Note: This is different from PearPC. PearPC emulates a PowerPC processor, while VMware emulates a direct x86 platform.

*********

Copyright Information

Lately, several websites have copied and posted up the text on these pages. This is strictly forbidden and violators will be reported. You may only copy from this page on the condition that you will not publicly distribute this text on the internet and that you have notified us that you are reproducing the texts. Thanks for abiding this rule


Ever wanted to try out the famous Mac OS X operating system for yourself without getting a mac? Now you can, by using the x86 emulation software VMware Workstation (or Server), and to make it better, on a PC running Windows! Read on for more information:
Ever since Apple made the move to Intel processors, hackers have been trying hard to modify the x86 version of OS X to run on a PC. And, of course, they have indeed succeeded in doing it. Various hackers have released hacked ISO torrents that can be installed on PCs. However, this violates the Apple EULA agreement and there are legal issues with using the ISOs. The legal ways to obtain a copy would be:

1) Become an Apple Developer ($500 membership)

2) Buy a real mac, deactivate the copy of OS X and install it on a PC (this way would be pointless because the whole point is to run OS X without getting a mac). This way also somewhat violates the EULA because the agreement says that you can’t run OS X on non-Apple hardware.

Its best to get a legal copy of the ISO because then you can install the software without worry about malicious software or about the software phoning home.

With that said, lets begin.



System Requirements:

  • Processor supporting SSE2 or SSE3 instructions (Use CPU-Z for Windows to check)
  • Windows 2000 or higher/Linux (Mandrake, SUSE, or Red Hat)
  • 512MB of RAM (strongly recommended)
  • 6GB minimum hard drive space
  • 8MB of VRAM
  • DVD-RW drive if you are burning the ISO

Software Requirements:

  • VMware Server (Free) or VMware Workstation 5 (commercial, recommended) or higher. VMware 6 is recommended.
  • Note: VMware ACE Editions apparently have problems with networking in Mac OS X.
    Attention Vista users: VMware Workstation 5.5 will not work. You need Workstation 6
    VMware Workstations 6.0.1 and 6.0.2 are NOT recommended. It is recommended you use Workstation 6.0 build 45731
  • Mac OS x86 ISO; For test purposes ONLY, in this guide the “JaS Mac OS X 10.4.8 Intel/AMD SSE2 SSE3 PPF1+PPF2″ ISO will be used. Mac specific DVDs cannot be used.
  • Burning software to burn the ISO to DVD (optional, recommended)
  • Blank 4.7GB DVD+R/DVD-R/DVD-RW/DVD+RW disc (if you are burning)
  • Daemon Tools or Virtual Clone Drive (if you are not burning the ISO)

Step 1: Install software

Install all the software that is required. VMware is mandatory. If you are going to burn the ISO file to a DVD (recommended), you will need burning software such as NTI CD/DVD Maker or Nero Burning ROM. If you aren’t going to burn the disc, then you will need drive emulation software such as Daemon Tools or Virtual Clone Drive.

Step 2a: Burn the ISO (if you are burning)

Use your favourite burning software to burn the ISO image to DVD. Insert the bruned DVD into your optical drive.

Step 2b: Mount the image (if you are not burning)

Mount the OS x86 DVD ISO file in Daemon Tools or Virtual Clone Drive (You can use Alcohol 120% if you want). You cannot mount the ISO directly in VMware because VMware cannot properly read HFS+ images (thats the format the Mac OS ISO is in)


Step 3: Configure VMware

Note: In this guide, VMware Workstation 6 will be used. VMware Server or Workstation 5 can be used, but Workstation 6 is strongly recommended.

  • Launch VMware
  • On the home page, click “Create new virtual machine” to bring up the dialog below:

Wizard 1

  • Click “Next”

Wizard 2

  • Make sure “Typical” is chosen and click Next
  • Important Note: If you are installing directly to a physical drive or partition (ignore this tip if you don’t know what this is, its an advanced option) choose the Custom option and when you get to the screen that deals with hard drives, set VMware to access a physical partition or disk

Wizard 3

  • Choose Other as the Guest OS and choose Other for the version. Click Next
  • Note: There are several Guest OSes that you can choose for Mac OS X. The best are:

- Other , Other
- Linux , Other Linux
- Other , FreeBSD
- Windows NT (works well if you are getting ACPI errors but make sure your virtual hard drive images are IDE, not SCSI)

- Make sure that your virtual disks are set the IDE mode not SCSI

Wizard 4

  • Give the machine a name.  Click Next
  • Speed-up tip: Store the virtual machine in a partition or hard disk that is separate from the current partition/hard disk that you are currently using. This will make the virtual machine somewhat faster.

Wizard 5

  • Click “Use network address translation (NAT)” if you are using a official legal copy of OS x86 or “Use host-only networking” if you are using a hacked ISO image (for test purposes, of course :) to prevent Mac OS X from registering itself during installation
Wizard 6

Choose a disk size (6GB is minimum). If you choose 6GB, you will have 1.5GB of space left after installation for your own programs. Any size is OK as long as you have the hard drive space. Check the “Allocate all disk space now” checkbox (not necessary, but it improves speed). Choose “Split disk into 2GB files” if you are putting the virtual machine on a FAT32 partition. Click Finish and wait till the virtual disk is created.

Home

(click to enlarge)

  • Click VM >> Settings

Unmodified Settings

(click to enlarge)

  • Click on “Floppy” and click Remove (You don’t need floppies for OS X)
  • Click on “Memory” and on the right, adjust the memory amount to about half your actual system memory.

CD  Settings

(click to enlarge)

  • Click “CD-ROM (IDE 1…” and on the right, select your virtual image drive/physical drive from the drop-down menu. Click OK to return back to Home. Close VMware Workstation or Server.
  • If you wish, you can click “Add” to add a USB Controller (not tested)


Step 4: Edit VMware config file

  • Navigate to the folder where you placed your virtual machine
  • Open the “VMware Configuration File” with Notepad
  • Add the line: paevm=”true” to the end of the file
  • Note: For networking in 10.4.8, add the line ethernet0.virtualDev=”e1000″ to the file
  • Note: Sometimes, the line scsi0.present=”TRUE” won’t work. Change it to scsi0.present=”FALSE”. However, on the test machine, this was not required.
  • Speed-up tip: set the guestOS line to “guestOS = “darwin”
  • Save the file. The end result should look somewhat like this:

Config  File

(click to enlarge)

Andate ora nella cartella sul vostro computer dove avete salvato la Virtual Machine e andate ad aprire il file di configurazione con estensione .vmx con il vostro editor preferito, cancellate tutto il testo ivi presente e copiate/incollate il seguente:

bios.bootDelay = "5000"
checkpoint.vmState = ""
checkpoint.vmState.readOnly = "FALSE"
config.version = "8"
deploymentPlatform = "windows"
displayName = "Leopard"
ehci.pciSlotNumber = "33"
ehci.present = "TRUE"
ethernet0.addressType = "generated"
ethernet0.connectionType = "nat"
ethernet0.generatedAddress = "00:0c:29:7b:c7:78"
ethernet0.generatedAddressOffset = "0"
ethernet0.pciSlotNumber = "32"
ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
ethernet0.wakeOnPcktRcv = "FALSE"
extendedConfigFile = "leopard.vmxf"
floppy0.autodetect = "TRUE"
floppy0.fileName = "A:"
floppy0.present = "FALSE"
guestOS = "freebsd-64"
ide0:0.fileName = "leopard.vmdk"
ide0:0.present = "TRUE"
ide0:0.redo = ""
ide1:0.autodetect = "FALSE"
ide1:0.deviceType = "cdrom-raw"
ide1:0.exclusive = "FALSE"
ide1:0.fileName = "Z:"
ide1:0.present = "TRUE"
memsize = "768"
mks.keyboardFilter = "allow"
monitor = "debug"
nvram = "leopard.nvram"
pciBridge0.pciSlotNumber = "17"
pciBridge0.present = "TRUE"
scsi0.pciSlotNumber = "-1"
scsi0.present = "FALSE"
scsi0.virtualDev = "lsilogic"
sound.autodetect = "TRUE"
sound.fileName = "-1"
sound.present = "FALSE"
svga.autodetect = "TRUE"
tools.remindInstall = "TRUE"
tools.upgrade.policy = "useGlobal"
usb.present = "FALSE"
uuid.action = "KEEP"
uuid.bios = "56 4d 50 97 29 7a 74 3f-a8 4a 39 81 24 7b c7 78"
uuid.location = "56 4d 50 97 29 7a 74 3f-a8 4a 39 81 24 7b c7 78"
virtualHW.productCompatibility = "hosted"
virtualHW.version = "6"

Note: If you make any changes to the virtual machine in the VMware interface after editing the file, all changes will be lost

Step 5: Configure VM BIOS

This is not exactly necessary, but it will make the VM a lot faster

  • Go back into VMware and click the green triangle to start your machine
  • Quickly click inside the VM window (this lets you control the VM)
  • Quickly tap F2 to enter the BIOS

BIOS 1

(click to enlarge)

  • Use the keyboard and Disable “Legacy Diskette A:”
  • Go into the Advanced tab >> I/O Device Configuration

BIOS 2Zoom
(click to enlarge)

  • Disable all Serial ports, Parallel ports, and Floppy Disk controllers
  • Press F10 to save and exit. The machine will reboot.


Step 6: Partition/Format the hard drive

  • If you have mounted the ISO/inserted the DVD, the machine should boot to the DVD. It prompts you to press any key to continue Mac OS X installation. Click inside the screen and press a key to start the installer
  • Note: If you are using a JaS 10.4.8 image without PPF1, the image will not boot in VMware.
  • After a long log/script of commands, the friendly installer screen will come up telling you to choose a language. Choose a language and click the Arrow to Continue
  • The DVD will prepare the installer and the main screen will come up
  • In the Utilities menu, choose Disk Utility
  • In Disk Utility, choose your VMware hard drive from the left. In the main area, click the Partition tab
  • Set the “Volume Scheme” to one partition
  • Give the partition a name
  • Make sure the format is set to “Mac OS Extended (Journaled)”
  • Make sure all the hard drive space is used
  • Click Partition, Partition

PartitionZoom

(click to enlarge)

  • Once the process is done, click the red X button to close Disk Utility and relaunch the installer
  • Note: If you are using a JaS 10.4.8 image that is not patched with PPF2, the new partition will not be usable. Get a new image OR use a previous version image (10.4.7, etc.) to partition.
  • At the main installer screen, click ‘Continue’
  • Choose your newly formatted virtual HD and click Continue again

InstallZoom

(click to enlarge)

  • This part is a bit tricky:
  • The Printer Drivers and the Hardware support are useless. You can install the Language Translations and Additional Fonts if you use a language other than English. You can install X11 if you want to (It lets you run Linux packages). Finally, choose the patch that is right for your CPU (AMD or Intel). Choose everything you need and click Install
  • Wait for the installation to complete
  • At the end, the virtual machine will restart
  • Note: If you get a Kernel stack error in VMware after installation, ignore it and click OK
  • After the machine restarts, if all goes well, Mac OS X should boot!
  • Here’s a screenshot to prove it:

Install  DoneZoom

(click to enlarge)

Speed-up tip – After installation, go to System\Library\Extensions and delete AppleTPMACPI.kext if it exists\
Speed-up tip – Disable Dock Magnification


END OF INSTRUCTIONS

  • Press Ctrl + Alt to toggle between host and guest OS
  • VMware Tools is currently not available for OS X so you cannot run the VM at high resolutions. Some hackers are working on a way to use the Linux VMware Tools image to install it on OS X
  • The processor speed is equivalent to that of a low end G3
  • The VM is usable, and more responsive than PearPC
  • Share/Bookmark

nnadalca Documenti Tecnici, Vmware - Virtualizzazione ,

Secure Server fail2ban , blocchiamo chi insiste

19 febbraio 2010



Chi gestisce normalmente server ed e’ esposto direttamente alla rete avra’ notato sicvuramente molteplici tentativi di attacco Brute Force sui servizi piu’ comuni. A tal poposito puo’ risultare utile il software Fail2ban che permette di riconoscere con determinate policy un tentativo di attacco e filtrarne automaticamente la provenienza. Il server su cui si installa Fail2Ban deve avere gia’ installato iptables.

La presente guida mostra come installare e configurarlo al meglio.

Dunque, si parte come al solito con il reperimento del pacchetto necessario direttamente dagli apt sources. Si esegua quindi il comando:

apt-get install fail2ban

La directory con tutti i file sara’ di default /etc/fail2ban

All’interno della cartella /etc/fail2ban/filter.d/ ci sono tutte le regole che permettono di identificare un tentativo di attacco con le regexp ed il nome della regola.

Il file di configurazione che piu’ ci interessa e’ il file /etc/fail2ban/jail.conf che dispone di molte direttive.

Si esegua quindi:

vi /etc/fail2ban/jail.conf

E’ importante specificare nella sezione [Default] le regole principali che sono:

ignoreip: contente la lista degli IP che devono essere ignorati da fail2ban, nel caso di piu’ IP devono essere separati dallo spazio. Solitamente qui vengono inseriti gli IP affidabili come computer remoti con IP statici e altre trusted network

bantime: tempo durante il quale un eventuale IP deve rimanere bannato successivamente al riconoscimento di un tentativo di brute force

maxretry: numero massimo di tentativi errati di accesso dopo il quale deve essere riconosciuto come un brute force. Se ad esempio impostiamo il numero a 3 sul servizio SSH ho la possiblita’ di sbagliare 3 volte la password dopodiche’ vengo considerato come un attacker.

destemail: L’indirizzo email di riferimento per tutte le operazioni effettuate da fail2ban

Nella sezione successiva, la sezione “Action” permette di specificare cose deve fare fail2ban quanto riconosce un tentativo di attacco. Ci sono delle regole preconfigurate che risultano essere piu’ che sufficenti ma e’ possibile aggiungerne altre a picimento. Alla fine si impostera’ l’azione desiderata mediante il campo:

action=<nome_azione>

Consiglio di impostare nome_azione con “action_mwl” che permette di bannare l’IP ed inviare via email l’avvenuto con tutte le informazioni compresa la nazione di provenienza dell’IP filtrato.

A questo punto si passa alla configurazione del comportamento di fail2ban in relazione ai servizi. Esistono molti servizi gia’ configurati. Ad esempio nella sezione [ssh] potete decidere di impostare i campi:

enabled = ‘true’ se si intende abilitare fail2ban sul servizio ssh, ‘false’ se si intende trascurare il servizio

port    = 22 se ssh opera sulla porta di default oppure il numero su cui ssh e’ stato configurato

filter = contiene il nome della regola che si deve considerare per il servizio ssh, nome definito all’interno della configurazione /etc/fail2ban/filter.d/

logpath = il file di log che si deve analizzare per individuare i tentaivi di attacco brute force. Nel caso di ssh (ma anche per altri servizi) e’ il file /var&log/auth.log

maxretry = e’ possibile impostare un numero di maxrestry indipendentemente dall’impostazione di default.

Una volta che abbiamo configurato tutti i servizi possiamo avviare file2ban:

/etc/init.d/fail2ban start

Buon lavoro

  • Share/Bookmark

nnadalca Documenti Tecnici, Tips Linux e Microsoft