Next Previous Contents

4. AVAILABLE PLUGINS

specter does nearly nothing on its own, it uses plugins for all the dirty work. They are divided into two groups. Input plugins analyze a packet and create hash table concerning received data, in the form like key=value. They don't open files nor they take any input from user. Only output plugins take options. They actually use data from input plugins - save it into logs/databases or execute appropriate commands. So it's vital for you to learn about their configuration, because it's the essence of using specter.

4.1 Input plugins

Every input plugin analyze incoming packet in special way and generate appropriate keys, which then can be parsed or saved by output plugins. You can check what keys are generated by each input plugin by looking at plugin's source - somewhere on top there's a definition of specter_iret_t array, which lists all of them. For example, specter_BASE generates keys like raw.mac, ip.protocol or icmp.type, among many others of course. Note that not all keys will be set during packet parsing, these that won't be set will remain empty. Different output plugins handle this case differently, please read details in their documentation.

specter comes with the following input plugins:

specter_BASE.so

Basic input plugin for nfmark, timestamp, mac address, ip header, tcp header, udp header, icmp header, ah/esp header... Most output plugins need this very important plugin.

specter_PWSNIFF.so

Example input plugin to log plaintext passwords as used with FTP and POP3. Don't blame me for writing this plugin! The protocols are inherently insecure, and there are a lot of other tools for sniffing passwords... it's just an example.

specter_LOCAL.so

This is a 'virtual interpreter'. It doesn't really return any information on the packet itself, rather the local system time and hostname. Please note that the time is the time at the time of logging, not the packets receive time.

specter_HTTP.so

This plugin divides http message into set of keys, like protocol version or User-Agent header value. Number of supported headers is high, check the sources for full list.

4.2 Output plugins

specter comes with the following output plugins:

specter_EXEC.so

This plugin executes specified command when packet is received. By proper use of its functions you can dynamically change your firewall configuration, or even set up simple port-knocking utility.

command

That option defines a command that should be executed. Don't rely on your $PATH environment variable, and provide full path to an executable. Few printf-like macros can be used, which are expanded during parsing of every packet:

%I

interface packet got received from

%O

interface packet is going to be sent to

%S

IP address of source host

%D

IP address of destination host

%P

IP protocol number (see /etc/protocols)

%s

TCP/UDP source port

%d

TCP/UDP destination port

%i

ICMP type value

If you want to use literal '%' in command, write it double '%%'. You can also use shell-like stdin/stdout/stderr redirections. > or 1> truncates file to zero length and redirects stdout to it. >> or 1>> will append stdout stream to destination file. In the same manner work 2> and 2>> redirections, except that they apply to stderr. To redirect stdout and stderr to the same file, use &> or &>>. Redirecting input is done by < operator, of course.

force

When a macros expansion is being done, and any field is empty, executing of a given command is aborted. For example, if you have %i in your command and specter gets a tcp packet, command won't be executed, 'cos given macro cannot be expanded (there's no ICMP type field in a TCP packet). You can override this behavior by setting force option. Instead of bogus data, string "invalid" will be placed. It's up to executed application to work with that.

wait

Deprecated. Specter should never hang on another process. This was a bad fix to prevent zombie processes. Now it's fixed and this option does nothing.

environment

If set, child will inherit specter's environment. In other case child be be run in empty environment.

specter_OPRINT.so

A very simple output module, dumping all packets in the format

===>PACKET BOUNDARY
key=value
key=value
...
===>PACKET BOUNDARY
...
to a file. The only useful application is debugging.

The module defines the following configuration directives:

logfile

The filename where it should log to. The default is /var/log/specter.oprint

specter_LOGEMU.so

An output module which tries to emulate the old syslog-based LOG targed as far as possible. Logging is done to a seperate textfile instead of syslog, though.

The module defines the following configuration directives:

logfile

The filename where it should log to. The default is /var/log/specter.logemu

sync

Define this option if you want to have your logfile written synchronously. This may reduce performance, but makes your log-lines appear immediately.

tcp_options

Works the same way as ipt_LOG --log-tcp-options parameter. It enables logging of tcp options.

ip_options

Log options from IP packet header (equivalent to --log-ip-options from ipt_LOG target).

tcp_seq

Enable logging of tcp sequence numbers.

mac_header

Log MAC values of incoming packets.

specter_MYSQL.so

An output plugin for logging into a mysql database. This is only compiled if you have the mysql libraries installed, and the configure script was able to detect them. (that is: --with-mysql was specified for ./configure)

The plugin automagically inserts the data into the configured table. It connects to mysql during the startup phase of specter and obtains a list of the columns in the table. Then it tries to resolve the column names against keys of input plugins. This way you can easly select which information you want to log - just by the layout of the table.

If, for example, your table contains a field called 'ip_saddr', specter will resolve this against the key 'ip.saddr' and put the ip address as 32bit unsigned integer into the table.

You may want to have a look at the file 'doc/mysql.table' as an example table including fields to log all keys from specter_BASE.so and some from specter_HTTP.so. Just delete the fields you are not interested in, and create the table.

The module defines the following configuration directives:

db

Name of the mysql database.

table

Name of the table to which specter should log.

host

Name of the mysql database host. If it's 'localhost' or undefined, specter first tries to connect to local host by unix socket if possible.

port

Server port number for the tcp/ip connection.

user

Name of the mysql user, if ommited, the current user is assumed.

pass

Password for mysql.

buffsize

Size of a query buffer. You should set it only in a situation when you see "SQL buffer too small. Insert aborted." messages in your logs. Never try to lower this value below default, unless you really know what you're doing.

ssl_enable

If this boolean option is set, MYSQL plugin will use SSL during connection to database.

ssl_key

Pathname to the key file.

ssl_cert

Pathname to the certificate file.

ssl_ca

Pathname to the certificate authority file.

ssl_capath

Pathname to a directory that contains trusted SSL CA certificates in pem format.

ssl_cipher

List of allowable ciphers to use for SSL encryption.

specter_PGSQL.so

An output plugin for logging into a postgresql database. This is only compiled if you have the postresql libraries installed, and the configure script was able to detect them. (that is: --with-pgsql was specified for ./configure)

The plugin automagically inserts the data into the configured table; It connects to postgresql during the startup phase of specter and obtains a list of the columns in the table. Then it tries to resolve the column names against keys of input plugins. This way you can easly select which information you want to log - just by the layout of the table.

If, for example, your table contains a field called 'ip_saddr', specter will resolve this against the key 'ip.saddr' and put the ip address as 32bit unsigned integer into the table.

You may want to have a look at the file 'doc/pgsql.table' as an example table including fields to log all keys from specter_BASE.so and some from specter_HTTP.so. Just delete the fields you are not interested in, and create the table.

The module defines the following configuration directives:

db

Name of the postgresql database.

table

Name of the table to which specter should log.

host

Name of the postgresql database host. When undefined, specter try to connect to local database by unix socket.

port

Server port number for the tcp/ip connection, or socket file name extension for Unix-domain connections.

user

Name of the postgresql user, if ommited, the current user is assumed.

pass

Password for postgresql.

buffsize

Size of a query buffer. You should set it only in a situation when you see "SQL buffer too small. Insert aborted." messages in your logs. Never try to lower this value below default, unless you really know what you're doing.

ssl_enable

If this boolean option is set, PGSQL plugin will use SSL during connection to database.

specter_PCAP.so

An output plugin that can be used to generate libpcap-style packet logfiles. This can be useful for later analysing the packet log with tools like tcpdump or ethereal.

The module defines the following configuration directives:

logfile

The filename where it should log to. The default is: /var/log/specter.pcap

sync

Set this option if you want to have your pcap logfile written synchronously. This may reduce performance, but makes your packets appear immediately in the file on disk.

specter_SYSLOG.so

This plugin behaves much like LOGEMU, but logs its input into syslog.

Two options are allowed:

facility

Facility a message should be logged with. See syslog(3) manual page. specter accepts following facilities: deamon kernel, user, localx (where x is from 0 to 7).

level

Importance of a message. All standard syslog levels are allowed: emerg, alert, crit, err, warning, notice, info, debug.

tcp_options

Works the same way as ipt_LOG --log-tcp-options parameter. It enables logging of tcp options.

ip_options

Log options from IP packet header (equivalent to --log-ip-options from ipt_LOG target).

tcp_seq

Enable logging of tcp sequence numbers.

mac_header

Log MAC values of incoming packets.


Next Previous Contents