Created
September 17, 2014 21:12
-
-
Save psimonyi/2b7a62a163b1452f57c4 to your computer and use it in GitHub Desktop.
Forkbomb testing service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
int main() { | |
while (1) fork(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This service is for conveniently testing your own forkbombs. | |
# Don't expect it to do real security. | |
# 1. Update the ExecStart line to your own executable path. | |
# 2. Install (e.g. symlink) as /etc/systemd/system/forkbomb.service | |
# 3. sudo systemctl start forkbomb.service | |
# 4. Verify lots of processes. Optionally, view the log with journalctl. | |
# 5. sudo systemctl stop forkbomb.service | |
# 6. Resume computing with sanity intact. | |
[Unit] | |
Description=Forkbomb tester | |
[Service] | |
CPUShares=100 | |
MemoryLimit=1M | |
LimitNPROC=100 | |
CapabilityBoundingSet=~CAP_SYS_RESOURCE | |
NoNewPrivileges=true | |
KillSignal=SIGKILL | |
StandardOutput=journal | |
User=nobody | |
ExecStart=/home/psimonyi/tmp/forkbomb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment