|
2 | 2 | - [Performance / Important notes](#some-considerations) |
3 | 3 | * [localhost connections](#localhost-connections) |
4 | 4 | - [Best practices](#best-practices) |
| 5 | +- [For servers](#for-servers) |
5 | 6 |
|
6 | 7 | --- |
7 | 8 |
|
@@ -256,9 +257,61 @@ If you want to restrict it further, under the `Addresses` tab you can review wha |
256 | 257 |
|
257 | 258 | If `/proc/sys/kernel/unprivileged_userns_clone` is set to 1, change it to 0. Until we obtain the checksum of a binary, it's better to set it to 0. |
258 | 259 |
|
259 | | -- Don't allow connections opened by binaries located under certain directories: `/dev/shm`, `/tmp`, `/var/tmp` or `/memfd` |
| 260 | +### For servers |
| 261 | + |
| 262 | + These recommendations also apply to the Linux Desktop, but are specially important on servers. |
| 263 | + |
| 264 | + Why? If someone gets access to the system, usually there're a few directories where everyone can write files: `/tmp`, `/var/tmp` or `/dev/shm`. |
| 265 | + Thus these directories are usually used to drop malicious files or download remote binaries to escalate privileges, mine cryptocoins, etc. |
| 266 | + |
| 267 | + Usually the attackers use `wget`, `curl` or `bash` to establish outbound connections ([malware examples](https://github.com/evilsocket/opensnitch/discussions/1119)). So, if you don't need these binaries, just uninstall them. |
260 | 268 |
|
261 | | - Why? If someone gets access to your system, usually these directories are the only ones where they can write files, thus it's usually used to drop malicious files, that download remote binaries to escalate privileges, etc. |
| 269 | +- If you need them, restrict their outbound connections as much as possible: |
| 270 | + Set the DefaultAction to `deny` or `reject` in `default-config.json`, and create a similar rule to this: |
| 271 | + (you can also create this rule, and another one to deny everything from curl/wget). |
| 272 | + |
| 273 | + ``` |
| 274 | + { |
| 275 | + "created": "2020-02-07T14:16:20.550255152+01:00", |
| 276 | + "updated": "2020-02-07T14:16:20.729849966+01:00", |
| 277 | + "name": "allow-curl-net-proxy", |
| 278 | + "description": "allow curl only to 10.168.10.164 on port 8081", |
| 279 | + "enabled": true, |
| 280 | + "precedence": false, |
| 281 | + "action": "allow", |
| 282 | + "duration": "always", |
| 283 | + "operator": { |
| 284 | + "type": "list", |
| 285 | + "operand": "list", |
| 286 | + "list": [ |
| 287 | + { |
| 288 | + "type": "simple", |
| 289 | + "operand": "process.path", |
| 290 | + "sensitive": false, |
| 291 | + "data": "/usr/bin/curl", |
| 292 | + "list": null |
| 293 | + }, |
| 294 | + { |
| 295 | + "type": "simple", |
| 296 | + "operand": "dest.ip", |
| 297 | + "sensitive": false, |
| 298 | + "data": "10.168.10.164", |
| 299 | + "list": null |
| 300 | + }, |
| 301 | + { |
| 302 | + "type": "simple", |
| 303 | + "operand": "dest.port", |
| 304 | + "sensitive": false, |
| 305 | + "data": "8081", |
| 306 | + "list": null |
| 307 | + } |
| 308 | + ] |
| 309 | + } |
| 310 | + } |
| 311 | + ``` |
| 312 | + |
| 313 | + |
| 314 | +- Don't allow connections opened by binaries located under certain directories: `/dev/shm`, `/tmp`, `/var/tmp` or `/memfd` |
262 | 315 |
|
263 | 316 | There're ton of examples (more common on servers than on the desktop): |
264 | 317 |
|
@@ -291,4 +344,8 @@ If you want to restrict it further, under the `Addresses` tab you can review wha |
291 | 344 | } |
292 | 345 | ``` |
293 | 346 |
|
| 347 | +- You can also block outbound connections to crypto mining pools and malware domains/ips with [blocklists rules]https://github.com/evilsocket/opensnitch/wiki/block-lists). |
| 348 | + One of the common reason to compromise servers is to mine cryptos. Denying connections to the mining pools, disrupts the operation. |
| 349 | + |
294 | 350 | **Note** that the default policy should be deny everything unless explicitely allowed. But by creating a rule to deny specifically these directories, you can have a place where to monitor these executions. |
| 351 | + |
0 commit comments