SAMHAINRC(5)
β¨ NAME β¨
samhainrc β the configuration file for samhain(8), bestie. π
π¨ WARNING π¨
okay so real talk: the information in this man page is not always up to date. The authoritative documentation is the user manual. So if something looks sus, check the user manual. No cap. π
πΈ DESCRIPTION πΈ
The configuration file for samhain(8) is named samhainrc and it lives in /etc by default. π
It contains several sections, indicated by headings in square brackets. Each section may hold zero or more key=value pairs. Blank lines and lines starting with # are comments. Everything before the first section and after an [EOF] is ignored. The file may be (clear text) signed by PGP/GnuPG, and samhain may invoke GnuPG to check the signature if compiled with support for it. π
Conditional inclusion of entries for some host(s) is supported via any number of @hostname/@end directives. @hostname and @end must each be on separate lines. Lines in between will only be read if hostname (which may be a regular expression) matches the local host. π₯οΈ
Likewise, conditional inclusion of entries based on system type is supported via any number of $sysname:release:machine/$end directives. sysname:release:machine can be inferred from uname -srm and may be a regular expression. π§
Filenames/directories to check may be wildcard patterns. β¨
Options given on the command line will override those in the configuration file. The recognized sections in the configuration file are as follows: π
Boolean options can be set with any of 1|true|yes or 0|false|no. β
π [ReadOnly] π
This section may contain file=PATH and dir=[depth]PATH entries for files and directories to check. All modifications except access times will be reported for these files. [depth] (use without brackets) is an optional parameter to define a per-directory recursion depth. π
π [LogFiles] π
As above, but modifications of timestamps, file size, and signature will be ignored. π
π [GrowingLogFiles] π
As above, but modifications of file size will only be ignored if the size has increased. π
π [Attributes] π
As above, but only modifications of ownership and access permissions will be checked. π
π [IgnoreAll] π
As above, but report no modifications for these files/directories. Access failures will still be reported. π
π [IgnoreNone] π
As above, but report all modifications for these files/directories, including access time. π
π [User0] π
π [User1] π
π [User2] π
π [User3] π
π [User4] π
These are reserved for user-defined policies. π¨
π [Prelink] π
For prelinked executables / libraries or directories holding them. π
π [Log] π
This section defines the filtering rules for logging. It may contain the following entries:
MailSeverity=valβ where the threshold valuevalmay be one ofdebug,info,notice,warn,mark,err,crit,alert, ornone. By default, everything equal to and above the threshold will be logged. The specifiers*,!, and=are interpreted as 'all', 'all but', and 'only', respectively (like in the Linux version ofsyslogd(8)). Time stamps have the prioritywarn, system-level errors have the priorityerr, and important start-up messages the priorityalert. The signature key for the log file will never be logged to syslog or the log file itself. For failures to verify file integrity, error levels are defined in the next section. π§PrintSeverity=val,LogSeverity=val,ExportSeverity=val,ExternalSeverity=val,PreludeSeverity=val,DatabaseSeverity=val, andSyslogSeverity=valβ set the thresholds for logging via stdout (or/dev/console), log file, TCP forwarding, calling external programs, andsyslog(3). π
π [EventSeverity] π
SeverityReadOnly=val,SeverityLogFiles=val,SeverityGrowingLogs=val,SeverityIgnoreNone=val,SeverityIgnoreAll=val,SeverityPrelink=val,SeverityUser0=val,SeverityUser1=val,SeverityUser2=val,SeverityUser3=val, andSeverityUser4=valβ define the error levels for failures to verify the integrity of files/directories of the respective types. I.e. if such a file shows unexpected modifications, an error of levelvalwill be generated, and logged to all facilities with a threshold of at leastval. π¨SeverityFiles=valβ sets the error level for file access problems.SeverityDirs=valβ for directory access problems.SeverityNames=valβ sets the error level for obscure file names (e.g. non-printable characters), and for files with invalid UIDs/GIDs. π»
π [External] π
OpenCommand=pathβ Start the definition of an external logging program|script.SetType=log|srvβ Type/purpose of program (logfor logging).SetCommandline=listβ Command line options.SetEnviron=KEY=valβ Environment for external program.SetChecksum=valβ Checksum of the external program (checked before invoking).SetCredentials=usernameβ User as who the program will run.SetFilterNot=listβ Words not allowed in message.SetFilterAnd=listβ Words required (ALL) in message.SetFilterOr=listβ Words required (at least one) in message.SetDeadtime=secondsβ Time between consecutive calls. β±οΈ
π [Utmp] π
Configuration for watching login/logout events.
LoginCheckActive=0|1β Switch off/on login/logout reporting.LoginCheckInterval=valβ Interval (seconds) between checks for login/logout events.SeverityLogin=valSeverityLoginMulti=valSeverityLogout=valβ Severity levels for logins, multiple logins by same user, and logouts. π
π [SuidCheck] π
Settings for finding SUID/SGID files on disk.
SuidCheckActive=0|1β Switch off/on the check.SuidCheckExclude=pathβ A directory (and its subdirectories) to exclude from the check. Only one directory can be specified this way.SuidCheckSchedule=scheduleβ Crontab-like schedule for checks.SeveritySuidCheck=severityβ Severity for events.SuidCheckFps=fpsβ Limit files per seconds for SUID check.SuidCheckNosuid=0|1β Check filesystems mounted as nosuid. Defaults to not.SuidCheckQuarantineFiles=0|1β Whether to quarantine files. Defaults to not.SuidCheckQuarantineMethod=0|1|2β Quarantine method. Delete = 1, remove suid/sgid flags = 1, move to quarantine directory = 2. Defaults to 1 (remove suid/sgid flags). π‘οΈ
π [Mounts] π
Configuration for checking mounts.
MountCheckActive=0|1β Switch off/on this module.MountCheckInterval=secondsβ The interval between checks (default 300).SeverityMountMissing=severityβ Severity for reports on missing mounts.SeverityOptionMissing=severityβ Severity for reports on missing mount options.CheckMount=path [mount_options]β Mount point to check. Mount options must be given as comma-separated list, separated by a blank from the preceding mount point. π
π [UserFiles] π
Configuration for checking paths relative to user home directories.
UserFilesActive=0|1β Switch off/on this module.UserFilesName=filename policyβ Files to check for under each$HOME. Allowed values for 'policy' are:allignore,attributes,logfiles,loggrow,noignore(default),readonly,user0,user1,user2,user3, anduser4.UserFilesCheckUids=uid_listβ A list of UIDs where we want to check. The default is all. Ranges (e.g.100-500) are allowed. If there is an open range (e.g.1000-), it must be last in the list. π
π [ProcessCheck] π
Settings for finding hidden/fake, required processes on the local host.
ProcessCheckActive=0|1β Switch off/on the check.ProcessCheckInterval=secondsβ The interval between checks (default 300).SeverityProcessCheck=severityβ Severity for events (defaultcrit).ProcessCheckMinPID=pidβ The minimum PID to check (default 0).ProcessCheckMaxPID=pidβ The maximum PID to check (default 32767).ProcessCheckPSPath=pathβ The path tops(autodetected at compile time).ProcessCheckPSArg=argumentβ The argument tops(autodetected at compile time). Must yield PID in first column.ProcessCheckExists=regular_expressionβ Check for existence of a process matching the given regular expression. π
π [PortCheck] π
Settings for checking open ports on the local host.
PortCheckActive=0|1β Switch off/on the check.PortCheckInterval=secondsβ The interval between checks (default 300).PortCheckUDP=yes|noβ Whether to check UPD ports as well (default yes).SeverityPortCheck=severityβ Severity for events (defaultcrit).PortCheckInterface=ip_addressβ Additional interface to check.PortCheckOptional=ip_address:listβ Ports that may, but need not be open. Theip_addressis the one of the interface, the list must be comma or whitespace separated, each item must be(port|service)/protocol, e.g.22/tcp,nfs/tcp/nfs/udp.PortCheckRequired=ip_address:listβ Ports that are required to be open. Theip_addressis the one of the interface, the list must be comma or whitespace separated, each item must be(port|service)/protocol, e.g.22/tcp,nfs/tcp/nfs/udp. π
π [Database] π
Settings for logging to a database.
SetDBHost=db_hostβ Host where the DB server runs (default:localhost). Should be a numeric IP address for PostgreSQL.SetDBName=db_nameβ Name of the database (default:samhain).SetDBTable=db_tableβ Name of the database table (default:log).SetDBUser=db_userβ Connect as this user (default:samhain).SetDBPassword=db_passwordβ Use this password (default: none).SetDBServerTstamp=true|falseβ Log server timestamp for client messages (default:true).UsePersistent=true|falseβ Use a persistent connection (default:true). πΎDaemon=no|yesβ want it to β¨detachβ¨ from the controlling terminal and go full daemon mode? that's this. otherwise it stays attached like a clingy bestie πMessageHeader=formatβ custom format for the message header, make it yours π the replacement tokens are:%Fsource file name,%Lsource file line,%Sseverity,%Ttimestamp,%Cmessage class.VersionString=stringβ set a version string to shove into the file signature database (it goes in alongside the hostname and the date) πΈSetReverseLookup=true|falseβ iffalse, skip reverse lookups when connecting to a host that's known by name instead of by IP address.HideSetup=yes|noβ don't log the name of the config/database files on startup. stealth mode, lowkey π€«SyslogFacility=facilityβ set which syslog facility to use. default isLOG_AUTHPRIV.MACType=HASH-TIGER|HMAC-TIGERβ set the type of message authentication code (HMAC). β οΈ has to be identical on client and server, no exceptions, periodt.StartupLoadDelay=valβ how many seconds to wait after startup before loading the database from the server. default is no wait at all.SetLoopTime=valβ the interval (in seconds) for timestamps.SetConsole=deviceβ set the console device (default is/dev/console).MessageQueueActive=1|0β whether to use a SysV IPC message queue or not.PreludeMapToInfo=listofseveritiesβ which severities (peep the[Log]section for those) get mapped to impact severity info in prelude.PreludeMapToLow=listofseveritiesβ same deal, but the ones mapped to impact severity low in prelude.PreludeMapToMedium=listofseveritiesβ severities mapped to impact severity medium in prelude.PreludeMapToHigh=listofseveritiesβ severities mapped to impact severity high in prelude.SetMailTime=valβ the max interval (in seconds) between successive e-mail reports. ngl the mail might be totally empty if there's nothing to report πSetMailNum=valβ the max number of messages that get stored up before they're e-mailed out. highest-priority messages always go out immediately though, no queueing, they're the main characters πSetMailAddress=username@hostβ sets the recipient address for mailing. no aliases, bestie. and for security you should really prefer a numerical host address π₯SetMailRelay=serverβ sets the hostname for the mail relay server (if you even need one). if no relay server is given, mail goes straight to the host in the mail address; otherwise it goes to the relay server, who's supposed to forward it to the given address.SetMailSubject=valβ defines a custom format for the subject line of an email message βοΈSetMailSender=valβ defines the sender for the'From:'field of a message.SetMailFilterAnd=listβ a list of strings where all of them have to match a message, or it does not get mailed.SetMailFilterOr=listβ a list of strings where at least one has to match a message, or it does not get mailed.SetMailFilterNot=listβ a list of strings where none of them should match a message, or it does not get mailed.SamhainPath=/path/to/binaryβ sets the path to thesamhainbinary. if you set this, samhain will checksum its own binary both on startup and on termination, then compare the two πSetBindAddress=IP_addressβ the IP address (i.e. the interface on a multi-interface box) to use for outgoing connections.SetTimeServer=serverβ sets the hostname for the time server.TrustedUser=name|uidβ add a user to the set of trusted users. root and the effective user are always trusted, and you can add up to 7 more users.SetLogfilePath=AUTO|/pathβ path to the logfile (AUTOtacks the hostname onto the compiled-in path).SetLockfilePath=AUTO|/pathβ path to the lockfile (AUTOtacks the hostname onto the compiled-in path).
Standalone or client only
SetNiceLevel=-19..19β set the scheduling priority during file check.SetIOLimit=bpsβ set IO limits (kilobytes per second) for the file check.SetFilecheckTime=valβ the interval (in seconds) between successive file checks.FileCheckScheduleOne=scheduleβ a crontab-like schedule for file checks. if you use this,SetFilecheckTimeis ignored, sorry bestie it's one or the other πUseHardlinkCheck=yes|noβ compare the number of hardlinks to the number of subdirectories for directories.HardlinkOffset=N:/pathβ an exception (use it multiple times for multiple exceptions).Nis the offset (actual minus expected hardlinks) for/path.AddOKChars=N1,N2,..β list of additional acceptable characters (byte value(s)) for the check for weird filenames. eachNnmay be hex (leading'0x':0xNN), octal (leading zero:0NNN), or decimal. useallfor all of them π¦FilenamesAreUTF8=yes|noβ whether filenames are UTF-8 encoded (defaults tono). ifyes, filenames get checked for invalid UTF-8 encoding and for ending in invisible characters π»IgnoreAdded=path_regexβ ignore it if this file/directory is added/created.IgnoreMissing=path_regexβ ignore it if this file/directory is missing/deleted.ReportOnlyOnce=yes|noβ report only once on a modified file (default isyes).ReportFullDetail=yes|noβ report in full detail on modified files, not just the modified items.UseLocalTime=yes|noβ report file timestamps in local time rather than GMT (default isno). β οΈ do not use this with Beltane.ChecksumTest={init|update|check|none}β defines whether to initialize/update the database or verify files against it. if it's'none', you should supply the required option on the command line.SetPrelinkPath=pathβ path of the prelink executable (default/usr/sbin/prelink).SetPrelinkChecksum=checksumβ TIGER192 checksum of the prelink executable (no default).SetLogServer=serverβ sets the hostname for the log server.SetServerPort=portnumberβ sets the port on the server to connect to.SetDatabasePath=AUTO|/pathβ path to the database (AUTOtacks the hostname onto the compiled-in path).DigestAlgo=SHA1|MD5β use SHA1 or MD5 instead of the TIGER checksum (default is TIGER192).RedefReadOnly=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the ReadOnly policy. the tests are:CHK(checksum),TXT(store literal content),LNK(link),HLN(hardlink),INO(inode),USR(user),GRP(group),MTM(mtime),ATM(atime),CTM(ctime),SIZ(size),RDEV(device numbers) and/orMOD(file mode). okay that's a lot but you got this πͺRedefAttributes=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the Attributes policy.RedefLogFiles=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the LogFiles policy.RedefGrowingLogFiles=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the GrowingLogFiles policy.RedefIgnoreAll=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the IgnoreAll policy.RedefIgnoreNone=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the IgnoreNone policy.RedefUser0=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the User0 policy.RedefUser1=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the User1 policy.RedefUser2=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the User2 policy.RedefUser3=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the User3 policy.RedefUser4=+/-XXX,+/-YYY,...β add or subtract testsXXXfrom the User4 policy.
Server Only
SetUseSocket=yes|noβ if unset, don't open the command socket. the default isno.SetSocketAllowUid=UIDβ which user can connect to the command socket. the default is0(root).SetSocketPassword=passwordβ password (max. 14 chars, no'@') for password-based authentication on the command socket (only if the OS doesn't support passing credentials via sockets).SetChrootDir=pathβ if set, chroot to this directory after startup.SetStripDomain=yes|noβ whether to strip the domain from the client hostname when logging client messages (default isyes).SetClientFromAccept=true|falseβ iftrue, use the client address as known to the communication layer. otherwise (the default) use the client name as claimed by the client, try to verify it against the address known to the communication layer, and accept it anyway β with a warning message β even if that verification fails πUseClientSeverity=yes|noβ use the severity of client messages.UseClientClass=yes|noβ use the class of client messages.SetServerPort=numberβ the port the server should use for listening (default is49777).SetServerInterface=IPaddressβ the IP address (i.e. the interface on a multi-interface box) the server should use for listening (default is all). useINADDR_ANYto reset it back to all.SeverityLookup=severityβ the severity of the message when the client address is not equal to the socket peer.UseSeparateLogs=true|falseβ iftrue, messages from different clients get logged to separate log files (the client's name gets appended to the name of the main log file to build the logfile name) ποΈSetClientTimeLimit=secondsβ the maximum time between client messages. if it's exceeded, a warning gets issued (the default is86400sec = 1 day).SetUDPActive=yes|noβyule 1.2.8+: also listen on514/udp(syslog).
[Clients]
this section only matters if samhain is running as a log server for clients on another machine (or literally the same one, we don't judge π«Ά).
Client=hostname@salt@verifierβ registers a client at hosthostname(fully qualified hostname required, don't skimp) for access to the log server. log entries from unregistered clients will not be accepted, no cap π«
to generate a salt and a valid verifier, use the command samhain -P password, where password is the password of the client. a simple utility program samhain_setpwd is provided to re-set the compiled-in default password of the client executable to a user-defined value.
[EOF]
an optional end marker. everything below it is ignored β¨ (a whole vibe)
SEE ALSO
AUTHOR
Rainer Wichmann (http://la-samhna.de) π
BUG REPORTS
if you find a bug in samhain, please send electronic mail to support@la-samhna.de. please include your operating system and its revision, the version of samhain, what C compiler you used to compile it, your 'configure' options, and anything else you deem helpful ππΈ
π COPYING PERMISSIONS π
okay so bestie, before you go running off to copy this page β there are rules, and they're actually super chill, but we respect them fr fr.
Copyright (Β©) 2000, 2004, 2005 Rainer Wichmann π
Permission is granted to make and distribute verbatim copies of this manual page, as long as the copyright notice and this permission notice stay preserved on all copies. like, don't go deleting them, that's the whole deal. π«Ά
Permission is granted to copy and distribute modified versions of this manual page under the same conditions as verbatim copying β provided that the entire resulting derived work gets distributed under the terms of a permission notice identical to this one. so you can remix it, slay, but the permissions notice has to travel with it, unchanged. no cap. β¨
tl;dr β copy it, remix it, share it, but keep the copyright notice and the permission notice intact, and any modified version ships with a notice identical to this one. that's it, that's the vibe check. πΈ
and that's the whole page, bestie β you made it to the end ππ¦ this one's from Jul 29, 2004, filed under SAMHAINRC(5). go forth and configure responsibly π
β
π¦ where this page comes from
- debian bookworm: samhain 4.1.4-2+b2
- debian trixie: samhain 4.1.4-6+deb13u1
- ubuntu jammy: samhain 4.1.4-2build2
- ubuntu noble: samhain 4.1.4-2.1ubuntu1
- ubuntu questing: samhain 4.1.4-7
- ubuntu resolute: samhain 4.1.4-7build1
- ubuntu stonking: samhain 4.1.4-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms