Skip to content
awick edited this page Dec 16, 2014 · 31 revisions

Table of Contents

INI Settings

Moloch uses a tiered system for configuration variables. This allows Moloch to share one config file for many machines. The ordering of sections in the config file doesn't matter.

Order of config variables:

  1. [optional] The section titled with the node name is used first. Moloch will always tag sessions with node:<node></node>
  2. [optional] If a node has a nodeClass variable, the section titled with the nodeClass name is used next. Sessions will be tagged with node:<node></node> which is useful if watching different network classes.
  3. The section titled "default" is used last.

Basic Settings

Setting Default Description
bpf EMPTY The bpf filter used to reduce traffic. Used both on live and file traffic.
certFile EMPTY Public certificate to use for https, if not set then http will be used. keyFile must also be set.
dontSaveTags EMPTY Semicolon ';' separated list of tags which once capture sets for a session causes the remaining pcap from being saved for the session. It is likely that the initial packets WILL be saved for the session since tags usually aren't set until after several packets
dropGroup EMPTY Group to drop privileges to. The pcapDir must be writable by this group or to the user specified by dropUser
dropUser EMPTY User to drop privileges to. The pcapDir must be writable by this user or to the group specified by dropGroup
elasticsearch localhost:9200 A comma separated list of host:port pairs to use to connect to the Elasticsearch cluster. If not using a VIP, a different Elasticsearch node can be specified for each Moloch node.
freeSpaceG 100 Delete pcap files when free space is lower then this. This does NOT delete the session records in the database. It is recommended this value is between 5% and 10% of the disk. Database deletes are done by the db.pl expire. Can also be specified using a percentage.
geoipASNFile EMPTY Path to the maxmind geoip ASN file. Download free version
geoipFile EMPTY Path to the maxmind geoip country file. Download free version
httpRealm Moloch HTTP Digest Realm - Must be in the default section of configuration file. Changing the value will cause all previous stored passwords to no longer work.
icmpTimeout 10 For ICMP sessions, Moloch writes a session record after this many seconds of inactivity since the last session save.
interface EMPTY The interface to listen on for live traffice
keyFile EMPTY Private certificate to use for https, if not set then http will be used. certFile must also be set.
maxFileSizeG 4 The max raw pcap file size in gigabytes. The disk should have room for at least 10*maxFileSizeG files.
maxFileTimeM 0 The max time in minutes between rotating pcap files. Useful if there is an external utility that needs to look for closed files every so many minutes. Setting to 0 means only use maxFileSizeG
maxPackets 10000 Moloch writes a session record after this many packets since the last save.
maxStreams 1500000 An aproximiate maximum number of active sessions Moloch/libnids will try and monitor
passwordSecret EMPTY Server-to-server and password hash secret - Must be in default section. Since elasticsearch is wide open by default, we encrypt the stored password hashes with this so a malicous person can't insert a working new account. It is also used for secure server-to-server communication. Don't set for no user authentication. Changing the value will make all previously stored passwords no longer work.
parseQAValue false Parse HTTP QA values
parseSMB true Parse extra SMB traffic info
parseSMTP true Parse extra SMTP traffic info
pcapDir EMPTY Semicolon separated list of directories to save pcap files to. The directory to save to is currently picked using round robin, need to add a smarter algorithm eventually.
parsersDir /data/moloch/parsers ; ./parsers Semicolon separated list of directories to load parsers from
pluginsDir EMPTY Semicolon separated list of directories to load plugins from
plugins EMPTY Semicolon separated list of plugins to load and the order to load them in. Must include the trailing .so
rirFile EMPTY Path of the RIR assignments file. Download
rotateIndex daily Specifies how often to create a new index in Elasticsearch. Use daily or hourly for busy live instances, use weekly or monthly for research instances. Changing the value will cause previous sessions to be unreachable thru the interface. If using the multi viewer then all Moloch clusters must have the same value.
Possible values are: hourly, daily, weekly, monthly.
smtpIpHeaders EMPTY Semicolon separated list of SMTP Headers that have ips, need to have the terminating colon ':'
spiDataMaxIndices 1 Specify the max number of indices we calculate spidata for. Elasticsearch will blow up if we allow the spiData to search too many indices.
tcpSaveTimeout 480 For TCP sessions, Moloch writes a session record after this many seconds since the last session save, no matter if active or inactive.
tcpTimeout 480 For TCP sessions, Moloch writes a session record after this many seconds of inactivity since the last session save.
titleTemplate _cluster_ - _page_ _-view_ _-expression_
  • _cluster_ = ES cluster name
  • _userId_ = logged in User Id
  • _userName_ = logged in User Name
  • _page_ = internal page name
  • _expression_ = current search expression if set, otherwise blank
  • _-expression_ = " - " + current search expression if set, otherwise blank, prior spaces removed
  • _view_ = current view if set, otherwise blank
  • _-view_ = " - " + current view if set, otherwise blank, prior spaces removed
udpTimeout 60 For UDP sessions, Moloch writes a session record after this many seconds of inactivity since the last session save.
userNameHeader EMPTY Header to use for determining the username to check in the database for instead of using http digest. Use this if you have apache or something else doing the auth. The Web Auth Header checkbox must be set for user.
viewerPlugins EMPTY Semicolon separated list of viewer plugins to load and the order to load them in. Must include the trailing .js
viewPort 8005 Port for viewer to listen on
viewUrl http[s]://hostname:[viewport] The URL used to accecss this viewer instance
webBasePath / The base url for Moloch web requests. Must end with a / or bad things will happen.
yara EMPTY Where to load Yara rules from.

Advanced Settings

Setting Default Description
compressES false Compress requests to ES, reduces ES bandwidth by ~80% at the cost of increased CPU. MUST have "http.compression: true" in elasticsearch.yml file
dbBulkSize 20000 Size of indexing request to send to Elasticsearch. Increase if monitoring a high bandwidth network.
dbFlushTimeout 5 Number of seconds before we force a flush to Elasticsearch
maxESConns 20 Max number of connections to Elasticsearch from capture process
maxESRequests 500 Max number of Elasticsearch requests outstanding in queue
offlineFilenameRegex (?i)\.(pcap|cap)$ Regexp to control which filenames are processed when using the -R option to moloch-capture. Since 0.11.3
packetsPerPoll 50000 Number of packets to ask libnids/libpcap to read per poll/spin. Increasing may hurt stats and Elasticsearch performance, decreasing may cause more dropped packets.
pcapBufferSize 100000 pcap library buffer size, see man pcap_set_buffer_size
pcapWriteMethod normal
  • normal = just normal open/writes uses the linux page cache heavily (default) probably want to tune vm.dirty_ratio and vm.dirty_background_ratio
  • direct = use O_DIRECT with open/write - writes directly to drives, no page cache, increase pcapWriteSize (>= 256k, must be multiple of 4096) and packetsPerPoll (>= 100k)
  • thread = like normal, but use a thread for all the writes
  • thread-direct = direct and thread together
pcapWriteSize 262144 Buffer size when writing pcap files. Should be a multiple of the raid 5/xfs stripe size and multiple of 4096 if using direct/thread-direct pcapWriteMethod
prefix EMPTY It is possible for multiple Moloch clusters to live inside the same Elasticsearch cluster by giving each Moloch cluster a different prefix value. (Added 0.11.3)
usersElasticsearch EMPTY It is possible for multiple Moloch clusters to share the same users table, so that the same accounts and settings work across all clusters. (Added 0.11.3)
usersPrefix [PREFIX] if set otherwise EMPTY Like prefix but only for the users table.

Debug Settings

Setting Default Description
logESRequests false Write to stdout Elasticsearch requests
logEventXPackets 50000 Write to stdout info every X packets. Set to -1 to never log status.
logFileCreation false Write to stdout file creation information
logUnknownProtocols false Write to stdout unknown IP protocols

moloch-clusters

The moloch-clusters section is used to describe the various moloch-clusters that are available to forward traffic to either manually or through the CRON functionality. Each line represents a single cluster, with the name just being any unique string.

[moloch-clusters]
cluster1=url:https://moloch.example.com:8005;passwordSecret:password;name:Cluster
cluster2=url:https://cluster2.example.com:8005;passwordSecret:foo;name:Test Cluster
url The base url to use to contact cluster
passwordSecret The passwordSecret for the remote cluster, if it is different from current cluster
name Friendly name to display in UI

Multi Viewer Settings

The multi viewer is useful when you have multiple Moloch clusters that you want to search across. To use an extra viewer process and a multies process must be started. These two processes can share the same config file and node name section. The viewer process uses the SAME configuration values as above.

A sample configuration for multi viewer. The elasticsearch variable points to the multies.js process.

[multi-viewer]
elasticsearch=127.0.0.1:8200
viewPort = 8009
viewHost = localhost
multiES = true
multiESPort = 8200
multiESHost = localhost
multiESNodes = escluster1.example.com:9200,prefix:PREFIX;escluster2.example.com:9200
Setting Default Description
multiES false This is the multiES node
multiESPort 8200 Port that multies.js should listen on
multiESHost EMPTY Host interface that multies.js should listen on
multiESNodes EMPTY Semicolon separated list of Elasticsearch nodes that MultiES should connect to. The first node listed will be considered the primary node and is used for users/views/queries. An optional "prefix:" element can follow each host if that cluster was setup with an Elasticsearch prefix.

override-ips

override-ips is a special section that overrides the MaxMind databases for the fields set, but fields not set will still use MaxMind (example if you set tags but not country it will use MaxMind for the country) Spaces and capitalization are very important.

[override-ips]
10.1.0.0/16=tag:ny-office;country:USA;asn:AS0000 This is neat
tag A single tag to set for matches
country A 3 character country code to set for matches
asn An ASN value to set for matches
rir A RIR value to set for matches

headers-http-request

This section makes it easy to specify HTTP Request headers to index. They will be searchable in the UI using http.[HEADERNAME]

[headers-http-request]
referer=type:string;count:true;unique:true
type
  • string - index as a string
  • integer - index as an integer
  • ip - index as an IP
unique true by default, only index unique values
count false by default, create a second field http.[HEADERNAME].cnt with the number items found

headers-http-response

This section makes it easy to specify HTTP Request headers to index. They will be searchable in the UI using http.[HEADERNAME]

[headers-http-response]
location=type:string
server=type:string

headers-email

This section makes it easy to specify email headers to index. They will be searchable in the UI using email.[HEADERNAME]

[headers-email]
x-priority=type:integer

plugin-fields

Should no longer be needed, but it allowed the definition of fields to be done in the config file instead of programmatically with the new fields API.

Clone this wiki locally