Closed paseaf closed 2 years ago
root@gateway-vm:~# cat /proc/$(pidof dockerd)/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes unlimited unlimited processes
Max open files 1048576 1048576 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 15657 15657 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
### Why we see the issue now
Because we started `dockerd` without giving an configuration file, `dockerd` then started with default soft limit. (1024)
#### How we started dockerd
```
killall dockerd
sudo dockerd \
-H unix:///var/run/docker.sock \
--tlsverify \
--tlscacert=ca.pem \
--tlscert=server-cert.pem \
--tlskey=server-key.pem \
-H=0.0.0.0:2376
```
(source: https://github.com/paseaf/ContainerSSH-honeypot/blob/main/terraform/scripts/restart_dockerd_with_tls.sh
#### System limits:
root@sacrificial-vm:/etc/docker# cat /proc/$(pidof dockerd)/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 0 bytes
Max resident set unlimited unlimited bytes
Max processes 15657 15657 processes
Max open files 1024 1048576 files
Max locked memory 514113536 514113536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 15657 15657 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
root@sacrificial-vm:~# cat /proc/$(pidof dockerd)/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes unlimited unlimited processes
Max open files 1048576 1048576 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 15657 15657 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
### Option 2: Add a configuration file to `/etc/docker/daemon.json` as suggested [here](https://docs.docker.com/config/daemon/systemd/#custom-docker-daemon-options)
> The recommended way is to use the platform-independent daemon.json file, which is located in /etc/docker/ on Linux by default.
We didn't use it because option 1 was easier to configure.
nofile
. https://github.com/paseaf/ContainerSSH-honeypot/issues/51#issuecomment-1193279149.We now have 29 guest containers running at the same time.
SSH into the honeypot also works
Current behavior:
dockerd
stopped respondingdockerd
logsContainerSSH logs
Investigation
Possible reason: too low default
nofile
(#open files limit) fordockerd
. Details: https://github.com/paseaf/ContainerSSH-honeypot/issues/51#issuecomment-1193271988Possible solution: start
dockerd
with a highernofile
limit Details: https://github.com/paseaf/ContainerSSH-honeypot/issues/51#issuecomment-1193279149TODOs