Skip to content

Commit c5cb63b

Browse files
committed
Add readme
1 parent a9c6d12 commit c5cb63b

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

README

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
Syscall-Intercept allows you to intercept syscalls issued by programs and then block or log them according to a config file.
1+
# syscall-interceptor
2+
3+
A program that intercepts syscalls issued by other programs and logs/blocks them.
4+
5+
## Configuring:
6+
The configuration is the `config.yml` file in the root of the repository.
7+
It only requires the `syscalls` field, however the `log_file` field should also be configured.
8+
An example configuration that blocks the `umount2(2)` syscall with the `MNT_DETACH` flag, which gets called when running `umount -l`:
9+
```
10+
log_file: /some/random/path
11+
syscalls:
12+
- umount2
13+
log: true
14+
block: true
15+
arg0: 1
16+
arg0_char: false
17+
```
18+
the name of the object is what gets interpreted as the syscall name, here the name `umount2` is taken, but `SYS_umount2` would also be accepted.
19+
each syscall object can have a total of 6 args, reaching from arg0 to arg5, each also having an Argo_char option, which needs to be set if the argN field is set.
20+
The argN_char option tells the parser if the argument is a string argument, e.g. if its a path, or if it a long, e.g. flags that can be raised, like `MNT_DETACH`.
21+
In the example, arg0 is set to a long of value 1, this corresponds to the `MNT_DETACH` flag, if, for example, the syscall should only be blocked if `MNT_DETACH` _and_ `MNT_FORCE` are set, then the result of a bitwise or (|=) with `MNT_DETACH` and `MNT_FORCE` (which is 3) should be set to arg0:
22+
```
23+
log_file: /some/random/path
24+
syscalls:
25+
- umount2
26+
log: true
27+
block: true
28+
arg0: 3
29+
arg0_char: false
30+
```
31+
32+
In the future an extra tool may be developed to either fully generate or at least assist with the generation of a configuration file.
33+
34+
## Building
35+
Dependencies:
36+
- gcc (or equivalent c compiler)
37+
- autotools
38+
- [syscall_intercept](https://github.com/pmem/syscall_intercept)
39+
40+
assuming `config.yml` has already been properly adjusted:
41+
```
42+
autoreconf --install
43+
./configure
44+
make
45+
```
46+
The resulting shared object file will be placed in `src/.libs`
47+
48+
## Usage
49+
To activate syscall-interceptor, libsyscall_interceptor.so will have to be preloaded.
50+
This can be done with the `LD_PRELOAD` environment variable:
51+
`LD_PRELOAD=/path/to/libsyscall_interceptor.so <command>`

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# syscall-interceptor
2+
3+
A program that intercepts syscalls issued by other programs and logs/blocks them.
4+
5+
## Configuring:
6+
The configuration is the `config.yml` file in the root of the repository.
7+
It only requires the `syscalls` field, however the `log_file` field should also be configured.
8+
An example configuration that blocks the `umount2(2)` syscall with the `MNT_DETACH` flag, which gets called when running `umount -l`:
9+
```
10+
log_file: /some/random/path
11+
syscalls:
12+
- umount2
13+
log: true
14+
block: true
15+
arg0: 1
16+
arg0_char: false
17+
```
18+
the name of the object is what gets interpreted as the syscall name, here the name `umount2` is taken, but `SYS_umount2` would also be accepted.
19+
each syscall object can have a total of 6 args, reaching from arg0 to arg5, each also having an Argo_char option, which needs to be set if the argN field is set.
20+
The argN_char option tells the parser if the argument is a string argument, e.g. if its a path, or if it a long, e.g. flags that can be raised, like `MNT_DETACH`.
21+
In the example, arg0 is set to a long of value 1, this corresponds to the `MNT_DETACH` flag, if, for example, the syscall should only be blocked if `MNT_DETACH` _and_ `MNT_FORCE` are set, then the result of a bitwise or (|=) with `MNT_DETACH` and `MNT_FORCE` (which is 3) should be set to arg0:
22+
```
23+
log_file: /some/random/path
24+
syscalls:
25+
- umount2
26+
log: true
27+
block: true
28+
arg0: 3
29+
arg0_char: false
30+
```
31+
32+
In the future an extra tool may be developed to either fully generate or at least assist with the generation of a configuration file.
33+
34+
## Building
35+
Dependencies:
36+
- gcc (or equivalent c compiler)
37+
- autotools
38+
- [syscall_intercept](https://github.com/pmem/syscall_intercept)
39+
40+
assuming `config.yml` has already been properly adjusted:
41+
```
42+
autoreconf --install
43+
./configure
44+
make
45+
```
46+
The resulting shared object file will be placed in `src/.libs`
47+
48+
## Usage
49+
To activate syscall-interceptor, libsyscall_interceptor.so will have to be preloaded.
50+
This can be done with the `LD_PRELOAD` environment variable:
51+
`LD_PRELOAD=/path/to/libsyscall_interceptor.so <command>`

0 commit comments

Comments
 (0)