Commit Graph

3632 Commits

Author SHA1 Message Date
Henri DF
260b96167c README: Minor format changes, remove tagline 2016-05-17 13:33:57 -07:00
Mark Stemm
0ed09d72db Use 0.1.0 as initial version.
This is a bit more consistent with sysdig.
2016-05-17 12:52:03 -07:00
Henri DF
d33ab98822 Merge pull request #74 from draios/remove-old-rule-examples
Remove outdated rule examples
2016-05-17 11:40:12 -07:00
Henri DF
6b749b3a5c Remove outdated rule examples 2016-05-17 18:36:26 +00:00
Mark Stemm
aec85ad6f3 Merge pull request #73 from draios/initial-changelog
Initial CHANGELOG.
2016-05-17 11:27:04 -07:00
Mark Stemm
88c903e6ba Initial CHANGELOG.
This will contain the changes for each release.
2016-05-17 11:26:22 -07:00
Mark Stemm
084267ae32 Merge pull request #71 from draios/rule-perf-improvements
Additional rule cleanups to improve performance.
2016-05-17 11:17:04 -07:00
Mark Stemm
ff9907b552 Merge pull request #66 from draios/add-community-readme
Add community links to README.
2016-05-17 09:36:01 -07:00
Henri DF
d373644bc1 Readme.md: update ignored syscalls
https://github.com/draios/sysdig/pull/592
2016-05-16 17:58:06 -07:00
Mark Stemm
6b58e94068 Add community links to README.
Falco for mailing list and slack. Use the general sysdig
twitter. Sysdig.com is the host for the blog but there's a link to posts
tagged with falco.
2016-05-16 17:46:21 -07:00
Mark Stemm
a7ecbcef38 Additional rule cleanups to improve performance.
We found during testing that rules without syscall/event conditions are
slower than other rules, so take a pass over the existing set of rules
ensuring that whenever possible they have a condition. The changes are:

 - Only process executions by interactive users are monitored
 - Only look at connect/listen/etc for system binaries performing
   network activity
 - Only monitor process executions when monitoring user management
   programs.

Also comment out all application rules by default so users can opt-in
for the applications they use instead of getting a lot of application
monitoring they may not need. Add a note stating they're all disabled by
default and can be re-enabled as needed.

Finally, remove some less common applications where we haven't done live
testing.

These 3 changes, along with those in
https://github.com/draios/sysdig/pull/592, result in a significant
performance increase on busy servers.
2016-05-16 17:38:01 -07:00
Mark Stemm
f5c3fc3a1c Merge pull request #64 from draios/add-names-descriptions
Add names descriptions
2016-05-16 12:33:45 -07:00
Henri DF
9bce37a2c3 Readme.md: remove 'socket' from ignored syscalls 2016-05-16 11:49:47 -07:00
Mark Stemm
3283ca1e5d Add some detail back to outputs.
For rules where evt.args had useful information but too much
information, add back specific values that have just the useful argument
from the event:

 - spawned shells contain the commandline--it's the exit half of the
   exec event so the current commandline is what was exec()d to.

 - setuid contains the uid being switched to.

While I was testing these, I had a couple of other fixes:

 - In the spawn shells rule, only track execve events so you don't catch
   clone() events that precede an exec.
 - in spawn_process only consider the exit half of the exec event.
2016-05-16 11:39:39 -07:00
Mark Stemm
a04fc9e2b5 Merge pull request #68 from draios/add-names-descriptions-loris
rule file improvement pass
2016-05-16 08:47:50 -07:00
Mark Stemm
fd3fa570a2 Add desc/rule fields to general rule documentation
We'll probably want a more formal set of documentation soon, but at
least they're mentioned now.

Also remove socket from the list of discarded events, thinking ahead to
when https://github.com/draios/sysdig/pull/591 will be merged.
2016-05-15 22:06:19 -07:00
Henri DF
fe741c928d Merge pull request #70 from draios/build-release-by-default
Make default release type "build"
2016-05-15 10:48:08 -07:00
Henri DF
acfa8e7686 Make default release type "build" 2016-05-15 17:43:10 +00:00
Loris Degioanni
21eb418878 merge add-names-descriptions 2016-05-15 10:07:43 -07:00
Loris Degioanni
4bd11ddcfc a couple of fixes in the rules file 2016-05-15 10:00:13 -07:00
Mark Stemm
7436bc0952 Allow package mgmt binaries to work in bin dirs.
A new macro package_mgmt_binaries includes dpkg and rpm. Those programs
are allowed to create directories and modify files below binary
directories. I'm not adding them to other trusted sets for now, though.
2016-05-14 21:57:57 -07:00
Mark Stemm
0a9a85d1da Also update README example to reflect new format.
Include full macros and rule for write_binary_dir.
2016-05-14 21:51:55 -07:00
Loris Degioanni
5eb368035a rule file improvement pass 2016-05-14 13:00:58 -07:00
Mark Stemm
4313c9f7a3 Tidy up output of existing rules.
Try to clean up the language of the existing rule set, expanding the
output when possible, removing %evt.dir in most cases.

There is one substantive change: the mkdir half of modify_binary_dirs
was split out into its own rule mkdir_binary_dirs.
2016-05-13 17:25:45 -07:00
Mark Stemm
7be0454f6f Add ability to print name/description of rules.
When run with -l <rule>, falco will print the name/description of the
single rule <rule> and exit. With -L, falco will print the
name/description of all rules.

All the work is done in lua in the rule loader. A new lua function
describe_rule calls the local function describe_single_rule once or
multiple times depending on -l/-L. describe_single_rule prints the rule
name and a wrapped version of the rule description.
2016-05-13 16:30:15 -07:00
Mark Stemm
e662d1eeeb Add name/description to rules.
Add name and description fields to all rules. The name field is actually
a field called 'rule', which corresponds to the 'macro' field for
macros.

Within the rule loader, the state changes slightly. There are two
indices into the set of rules 'rules_by_name' and
'rules_by_idx' (formerly 'outputs'). They both now contain the original
table from the yaml parse. One field 'level' is added which is the
priority mapped to a number.

Get rid of the notion of default priority or output. Every rule must now
provide both.

Go through all current rules and add names and descriptions.
2016-05-13 16:30:09 -07:00
Mark Stemm
d16cc67e98 Merge pull request #63 from draios/reduce-rules-fps
Reduce rule FPs based on more complex environments
2016-05-13 09:39:00 -07:00
Mark Stemm
070667cad0 Reduce rule FPs based on more complex environments
Update rules to reduce FPs after running against some real-world
environments with and without containers. Summary of changes:

 - Too many processes read /etc/passwd--it's world-readable and a
   side-effect of getpwent. Switch to /etc/shadow instead.

 - Add a mail_binaries group. This wasn't directly used, but it may be
   handy for other rules and goes along with the changes in #54.

 - not_cron was the only macro expressing a negative, so switch it to be
   a positive 'cron'. Also add crond as a cron process.

 - add dragent to the set of programs that can call setns.

 - For the shell detection rules, change them to only look for the
   specific exec/clone event rather than all follow-on activity. Also
   allow docker to spawn shell scripts--this is required for entrypoints
   that use the shell instead of a direct exec. Also add a few
   additional programs that can spawn shells.

 - In containers, shells are allowed as long as the parent process is
   docker or bash. Like the outside of container case, only the initial
   clone/exec is detected.

 - Fix a typo Sytem -> System.

 - Change the chmod rule to only protect imporant/sensitive files. I saw
   lots of "regular" files being chmod()ed.

 - Change the setuid test to allow root to setuid to anything, rather
   than listing a bunch of programs run as root that drop privileges.

 - Allow running su/sudo in containers. Some containers add users from a
   base linux distribution before running.
2016-05-12 18:01:23 -07:00
Mark Stemm
6e2c115e37 Merge pull request #54 from draios/rule-service-spawns-process
Don't let databases spawn processes after startup.
2016-05-12 17:55:20 -07:00
Henri DF
81df435471 Merge pull request #56 from draios/remove-install-falco
Remove `install-falco` script.
2016-05-12 11:32:00 -07:00
Henri DF
fbdab4362c Remove install-falco script.
It isn't being used yet, for now we're using the corresponding script
from the sysdig repo. Removing it to avoid confusion, we can later
re-add as necessary.
2016-05-12 17:31:34 +00:00
Mark Stemm
d1fb172bff Merge pull request #55 from draios/run-falco-in-docker
Run falco by default in containers.
2016-05-12 09:24:38 -07:00
Mark Stemm
0e40ad26c4 Run falco by default in containers.
Instead of running bash as the sysdig container does, run falco. This
makes sense as falco doesn't have a general purpose use like sysdig
does.

To make it easier to run both in docker and as a daemon using the
default command line, enable both syslog and stdout/stderr output by
default. Now that falco dups stdout/stderr to /dev/null when
daemonizing, the stdout/stderr is just thrown away. And when running in
docker, the syslog output will just be discarded unless someone plumbs
the container's syslog output.

Update README.md to reflect that specifying the falco command is not
necessary.
2016-05-11 17:35:02 -07:00
Mark Stemm
c761218bfe Don't let databases spawn processes after startup.
This will detect the result of some sql injection attacks where the
injected query tries to spawn a process.

We don't include web servers in this list for now due to things like
mod_perl, mod_php, etc. Maybe we can add it once we make exceptions for
those modules.
2016-05-11 15:36:48 -07:00
Mark Stemm
343e694ca4 Add back detection for mysql and sensitive files.
Add back detection for mysql and sensitive files that was removed in the
previous commit. A new macro proc_is_new adds a condition on how long a
process has been running.

A new rule triggers if the process is not new and tries to open a
sensitive file. This handles cases like mysql, where it *does* read
/etc/passwd on startup but shouldn't really open it afterward.
2016-05-11 15:36:48 -07:00
Mark Stemm
f64ea7def5 Add addl groups of binary programs.
Add some new groups of binary programs as macros and start using them in
the set of rules:

 - docker_binaries: docker and exe (which is a temporary process name
   for processes like docker-proxy)
 - http_server_binaries: httpd, nginx, and similar
 - db_server_binaries: mysql for now, we'll add more later
 - server_binaries: all of the above
 - userexec_binaries: sudo and su.

Start using these groups in the rules. Most of the time, changing from
the inline lists of processes to macros was a no-op. There are some
actual changes, though:

 - docker and exe are now allowed to read 'sensitive' files. They may
   not actually do so, but it's not really harmful.
 - lighttpd is now allowed to read 'sensitive' files, via inclusion in
   http_server_binaries.
 - su, lighttpd, and docker can now setuid.
 - http-foreground is included as a http server wrt non-port 80/443 ports.

I'm going to use these macros in some of the following rules.

This actually prevents detection of mysql reading sensitive files, which
is one of the demo scenarios (sql injection). I plan on adding this
detection back in the next commit.
2016-05-11 15:36:48 -07:00
Mark Stemm
f43e5e6c3d Merge pull request #52 from draios/add-license
Add license
2016-05-11 08:54:59 -07:00
Mark Stemm
6476a55ecc Add CLA section.
Add CLA section, using the sysdig CLA section and licenses as a
reference. The entity remains sysdig, but falco is used in the
signature.
2016-05-11 08:50:22 -07:00
Mark Stemm
8902257e81 Add license.
Licensed as GPLv2 like sysdig.
2016-05-11 08:50:22 -07:00
Mark Stemm
92c4c8f622 Merge pull request #50 from draios/cmdline-opts-daemonize
Clean up handling cmdline options wrt config file.
2016-05-11 08:46:59 -07:00
Henri DF
f0263285c3 Merge pull request #53 from draios/fix-lua-install-path
Fix install path for Lua files
2016-05-10 22:12:24 -07:00
Mark Stemm
4949da5835 Merge pull request #51 from draios/fix-remaining-falco-rules-conf
Fix remaining falco_rules.conf references.
2016-05-10 21:08:25 -07:00
Henri DF
451b450869 Fix install path for Lua files 2016-05-10 20:54:20 -07:00
Henri DF
56f806b7ea Update README.md
Add instructions for uninstallation
2016-05-10 20:27:26 -07:00
Mark Stemm
13fc4ca77a Fix remaining falco_rules.conf references.
Did a find looking for references to falco_rules.conf. Renamed to falco_rules.yaml.
2016-05-10 16:12:32 -07:00
Mark Stemm
79f9843256 Clean up handling cmdline options wrt config file.
Remove the old use of the '-o' command line option, it wasn't being
used.

Allow any config file option to be overridden on the command line, via
--option/-o. These options are applied to the configuration object after
reading the file, ensuring the command line options override anything in
the config file.

To support this, add some methods to yaml_configuration that allows you
to set the value for a top level key or key + subkey, and methods to
falco_configuration that allow providing a set of command line arguments
alongside the config file.

Ensure that any fatal error is always printed to stderr even if stderr
logging is not enabled. This makes sure that falco won't silently exit
on an error. This is especially important when daemonizing and when an
initial fatal error occurs first.

As a part of this, change all fatal errors to throw exceptions instead,
so all fatal errors get routed through the exception handler.

Improve daemonization by reopening stdin/stdout/stderr to /dev/null so
you don't have to worry about writing to a closed stderr on exit.
2016-05-10 15:52:59 -07:00
Henri DF
5263181b15 Merge pull request #49 from draios/rules-conf-to-yaml
Config file: falco_rules.{yaml,conf}
2016-05-10 13:53:06 -07:00
Henri DF
dbd50b8c26 Config file: falco_rules.{yaml,conf} 2016-05-10 20:52:02 +00:00
Henri DF
fae2c330dd Merge pull request #47 from draios/pre-release-documentation
Fill out README.md
2016-05-10 13:47:59 -07:00
Henri DF
492148d880 Running instructions 2016-05-10 13:47:30 -07:00