FS#25690 - Protect Arch against forkbomb
Attached to Project:
Arch Linux
Opened by Mamy Ratsimbazafy (ChoK) - Saturday, 20 August 2011, 15:39 GMT
Last edited by Gaetan Bisson (vesath) - Sunday, 21 August 2011, 20:00 GMT
Opened by Mamy Ratsimbazafy (ChoK) - Saturday, 20 August 2011, 15:39 GMT
Last edited by Gaetan Bisson (vesath) - Sunday, 21 August 2011, 20:00 GMT
|
Details
Description:
Following the newly implemented security flags in makepkg.conf. I would like to re-raise the issue of forkbombs. Arch is currently not protected against forkbombs. This means a user can crash his system with no privilege and only a bash shell. A common solution is to implement user quotas through /etc/security/limits.conf A discussion was started in 2005 in arch forums https://bbs.archlinux.org/viewtopic.php?id=10884 , I couldn't find a related bug report though. Steps to reproduce: Save your work, do not do it on a machine you don't own Open a bash shell and type one of the following lines : :(){ :|:& };: perl -e "fork while fork"& more(){tail $1 |more}; more /etc/security/limits.conf |
This task depends upon
Closed by Gaetan Bisson (vesath)
Sunday, 21 August 2011, 20:00 GMT
Reason for closing: Won't implement
Sunday, 21 August 2011, 20:00 GMT
Reason for closing: Won't implement
Many solutions exist (grsecurity, bastille, fork bomb defuser module) but except from a default preconfigured /etc/security/limits.conf they all involve installing additional packages.
For your information :
bastille recommends a maxprocess limit of 150 for the group "users", Debian uses a fixed 256, freebsd dynamically determine it according to the RAM (common values seem to be 1789 and 5547).
Those limits don't affect root, boot process will not be impacted.
I would like to see a sane default and also a comment about that in the Install guide, especially for multi seat users and server users). Of course if there are any other solution which does not set a fixed value but a value derived from the system capability, I'd be happy to discuss it.
* - nproc 500
in /etc/security/limits.conf would be sufficient. I use it without problems for years.
150 seems a like it could cause troubles, while 500 won't. Thus it efficiently denies fork bombs.
Also, may I suggest adding:
session required pam_limits.so
in /etc/pam.d/{su,sudo}, so that limits apply even to users not using login at all.
People use Arch in different ways, which results in different setups: the limit that works for you might not work for others.
Besides, we ship the limits.conf provided by PAM upstream; I would suggest that you take your request there.
simply because a user who knows will easily change the settings (that user must change it *anyway*).
user who doesn't know won't change that setting. If default is unrestricted, he will be victim of DOS attacks, while if default is restricted, he wont.
We don't do any harm with this, IMO.