Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing syscalls to i386 seccomp policy #13008

Merged
merged 6 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fixed `json.add_error_key` property setting for delivering error messages from beat events {pull}11298[11298]
- Fix Central Management enroll under Windows {issue}12797[12797] {pull}12799[12799]
- ILM: Use GET instead of HEAD when checking for alias to expose detailed error message. {pull}12886[12886]
- Fix seccomp policy preventing some features to function properly on 32bit Linux systems. {issue}12990[12990] {pull}13008[13008]

*Auditbeat*

Expand Down
4 changes: 4 additions & 0 deletions libbeat/common/seccomp/policy_linux_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func init() {
"fdatasync",
"flock",
"fstat64",
"fstatat64",
"fsync",
"ftruncate64",
"futex",
Expand All @@ -61,6 +62,7 @@ func init() {
"getpid",
"getppid",
"getrandom",
"getrlimit",
"getrusage",
"gettid",
"gettimeofday",
Expand All @@ -84,6 +86,7 @@ func init() {
"pipe2",
"poll",
"pread64",
"prlimit64",
"pselect6",
"pwrite64",
"read",
Expand All @@ -106,6 +109,7 @@ func init() {
"setuid32",
"sigaltstack",
"socketcall",
"splice",
"stat",
"stat64",
"statfs64",
Expand Down
44 changes: 44 additions & 0 deletions libbeat/tests/system/test_seccomp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import platform
import unittest
from base import BaseTest


def is_version_below(version, target):
t = map(int, target.split('.'))
v = map(int, version.split('.'))
v += [0] * (len(t) - len(v))
for i in range(len(t)):
if v[i] != t[i]:
return v[i] < t[i]
return False


# Require Linux greater or equal than 3.17 and 386/amd64 platform
def is_seccomp_supported():
p = platform.platform().split('-')
if p[0] != 'Linux':
return False
if is_version_below(p[1], '3.17'):
return False
return {'i386', 'i686', 'x86_64', 'amd64'}.intersection(p)


@unittest.skipUnless(is_seccomp_supported(), "Requires Linux 3.17 or greater and i386/amd64 architecture")
class Test(BaseTest):
"""
Test Beat seccomp policy is loaded
"""

def setUp(self):
super(BaseTest, self).setUp()

def test_seccomp_installed(self):
"""
Test seccomp policy is installed
"""
self.render_config_template(
)
proc = self.start_beat(extra_args=["-N"])
self.wait_until(lambda: self.log_contains("Syscall filter successfully installed"))

proc.kill_and_wait()