Debugging Systemd Seccomp
Seccomp Issues
Architecture dependent. What works on Intel / AMD64 might not work on arm64 etc.
To watch for systemd seccomp issues:
sudo journalctl _AUDIT_TYPE_NAME=SECCOMP -f
Sample issue (bold added):
SECCOMP auid=4294967295 uid=108 gid=118 ses=4294967295 subj==/usr/bin/sdwdate (enforce) pid=9740 comm="sdwdate" exe="/usr/bin/python3.7" sig=31 arch=c0000015 syscall=140 compat=0 ip=0x7fff96cc7df4 code=0x0
The relevant part in above log output snippet is syscall=140
.
The syscall table for your particular machine will be recorded in a header file. Open usr/include/ARCH-linux-gnu/asm/unistd.h
, replacing ARCH
- this should give you a pointer (in the form of a #include
statement) to the file containing the syscall table. You may have to "dig" more than one level deep to find it. The correct file will contain a list of numbers and syscall names that looks something like this:
#define __NR_read 0 #define __NR_write 1 #define __NR_open 2 #define __NR_close 3 #define __NR_stat 4 #define __NR_fstat 5 #define __NR_lstat 6
In this case we know that read
has syscall number 0
, write
has syscall number 1
, etc. Find the syscall number reported in the journal, and determine its corresponding name from the list.
If you cannot find the syscall table on your system, you may need to install linux-libc-dev
.
There are online syscall, tables, such as https://chromium.googlesource.com/chromiumos/docs/+/master/constants/syscalls.md and https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html, however these are not guaranteed to be accurate for your system. It is highly recommended to use the syscall table for your distribution as documented above.
Once you have the syscall name, add it to the system call whitelist in the systemd unit of the malfunctioning process.
Note: Replace sdwdate
with the systemd unit name to debug.
- sudoedit /lib/systemd/system/sdwdate.service && sudo systemctl daemon-reload && sudo systemctl restart sdwdate && sudo systemctl --no-pager --full status sdwdate
- sudoedit /lib/systemd/system/kloak.service && sudo systemctl daemon-reload && sudo systemctl restart kloak && sudo systemctl --no-pager --full status kloak
SystemCallFilter=
needs to be adjusted.
See also: https://github.com/Whonix/kloak/pull/1
We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!