You are not logged in.

#26 2005-03-21 16:28:34

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Forkbomb?

mico wrote:

Does anybody know what are default/sugested/common limits on *BSD systems? They would probably be a good reference.

good idea

Offline

#27 2005-03-21 17:36:39

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: Forkbomb?

I did some checking on my other boxes:

On debian sarge there are no limits set, /etc/security/* are all commented out. I wonder why that article said debian was fork-bomb proof. Maybe they tested woody.

On FreeBSD 5.3 there is no /etc/security/ at all. There must be limits set even without pam, because I can fork "only" about 3628 processes and then I get "resource temporarily unavailable". Funny, even with more than 3700 processes (of all users) running, the system is still very stable and responsive.

Offline

#28 2005-03-21 18:01:51

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Forkbomb?

Ok, zero questions of me answered. Also I already said that the max depends on your hardware. I give up...

Offline

#29 2005-03-23 16:51:43

thegnu
Member
From: Brooklyn, NY
Registered: 2004-05-04
Posts: 280
Website

Re: Forkbomb?

i3839 wrote:

Ok, zero questions of me answered. Also I already said that the max depends on your hardware. I give up...

As for "sane limits" being default for Arch, I think the first step is to choose a "standard" system.  Like say, 1Ghz w. 256MB ram.  People who have a slower computer can always set it lower, and people with a faster computer will be well protected by the default.

What would you guys consider a reasonable default system?  Again, my bid is 1Ghz 256MB


fffft!

Offline

#30 2005-03-23 17:16:00

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Forkbomb?

To summarize:

My p3 600 Mhz + 256 Mb ram can recover when the limit is 2048 processes per user. To be on the safe side taking the halve of that, 1024, seems reasonable.

mico mysteriously has problems with the 1024 limit, while his "default" limit is somehow lower. That are two riddles in one.

Now the remaining question is if 1024 isn't already insanely high, and if using a higher default limit actually adds anything. I think not, but if anyone disagrees then say so.

Offline

#31 2005-04-11 15:41:32

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Forkbomb?

My laptop crashes even with these rules when I use the bash varaint:

@users          hard    nproc           256
@users          soft    nproc           128

What does this mean? Should I lower them?

edit: It looks like /etc/security/limits.conf is completely being ignored here.
ulimit -u returns 3831, while I have set it to 256.

edit2: I think it has to do with kdm. limit.conf is only being processed on an ordinary console login.

Offline

#32 2005-04-11 17:46:23

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Forkbomb?

is 'users' the only group the user you are testing with is a member of?
ie. is the user being tested a member of other groups, like wheel?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#33 2005-04-11 20:11:20

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Forkbomb?

I replaced @users (which I was part of) with *. Still the same: max 3818 procs in X and 128 in console, according to ulimit -u.

Offline

#34 2005-04-11 21:30:32

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Forkbomb?

interesting. Now that I run ulimit -a, I realize that ulimit is not reporting correct values for me either...
*scratches chin*

man limits says the file should be /etc/limits. It makes a reference to LIMITS_FILE variable, being defined somewhere else. Also, limits is, I believe, part of the pam stack. Maybe it is not being called..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#35 2005-04-12 14:21:37

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Forkbomb?

/etc/limits is only used when PAM is disabled afaik.

I think I've found the cause. When I don't start kdm at boot (or stop it) and run startx, the values are correct. So it has something to do with my login manager.

Offline

#36 2005-04-12 14:50:35

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Forkbomb?

Apparently kdm and/or gdm don't have pam support, or it's broken ("ldd `which kdm` | grep pam" should give answer).

Offline

#37 2005-04-12 15:24:14

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Forkbomb?

kdm has pam support. I did some research and found out, that 'session required pam_limits.so' line is missing in /etc/pam.d/kde-np. It works just well with that.

*/me toddles to Mr. Bugtracker*

Offline

#38 2005-04-12 20:55:41

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Forkbomb?

Hym, I wonder. openssh (sshd) doesn't use pam in default, therefore it doesn't respect limits.conf settings. As, I presume, the biggest danger of forkbomb attack comes from remote users, don't you think sshd config should default to the use of pam (at least account and session, not necessarily auth) and its limit settings? Even if someone sets reasonable limits, overlooking this sshd setting may cause him some troubles. What's your opinion, guys?

Offline

#39 2005-04-12 21:09:56

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Forkbomb?

lucke, I think that is indeed why my limits appear to not be observed. If limits don't work via ssh, then what good are they..
Probably just a flag missing in the sshd conf file..
*rustles around in man pages*


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#40 2005-04-12 21:19:33

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Forkbomb?

There's a UsePam sshd config option...

An alternative may be to set the limits before starting sshd, but that's not a nice solution.

Offline

#41 2005-04-12 21:26:19

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Forkbomb?

Yep, there's UsePam, but by default it's set to No. And, what I was talking about in my previous post, imho it should be set to Yes by default ('sed' it during the build process, that is).

Offline

#42 2005-04-12 21:47:54

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Forkbomb?

thanks guys.
I set

ChallengeResponseAuthentication=no
UsePAM yes

and it is working fine now. tongue


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#43 2005-04-12 21:51:15

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Forkbomb?

lucke wrote:

Yep, there's UsePam, but by default it's set to No. And, what I was talking about in my previous post, imho it should be set to Yes by default ('sed' it during the build process, that is).

I'll second that - post a feature request to the bug tracker 8)

Offline

#44 2005-04-21 19:07:50

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Forkbomb?

It's still not working with kdm here.

my /etc/pam.d/kde-ng:

#%PAM-1.0
auth            required        pam_nologin.so
auth            required        pam_permit.so
account         required        pam_unix.so     service=system-auth
password        required        pam_unix.so     service=system-auth
session         required        pam_unix.so     service=system-auth
session         optional        pam_console.so
session         required        pam_limits.so

Offline

#45 2005-04-21 19:16:17

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Forkbomb?

It works properly here O_o

Are you sure you have proper limits set in limits.conf and does it actually show different values in virtual console and in Konsole?

Btw, filename is kde-np, not ng ;-)

Offline

#46 2005-04-21 19:41:07

shadowhand
Member
From: MN, USA
Registered: 2004-02-19
Posts: 1,142
Website

Re: Forkbomb?

Wow. I thought my system would be immune to a forkbomb for some reason. Using the -cko kernel, I killed my system in about 1 second using the bash forkbomb.

Needless to say, /etc/security/limits.conf is now set up properly.


·¬»· i am shadowhand, powered by webfaction

Offline

#47 2005-04-21 20:36:37

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: Forkbomb?

lucke wrote:

It works properly here O_o

Are you sure you have proper limits set in limits.conf and does it actually show different values in virtual console and in Konsole?

Btw, filename is kde-np, not ng ;-)

*               hard    nproc           200
*               soft    nproc           200
@users          hard    nproc           80
@users          soft    nproc           50
@users          -       maxlogins       4

about kde-np: typo smile

I am sure that in a virtual console the values differ from within kde.

Offline

#48 2006-08-26 17:46:20

detto
Member
Registered: 2006-01-23
Posts: 510

Re: Forkbomb?

Sry for reactivating this topic, but after reading the whole thread im still not sure if arch is per default protected against such fork bombs?! :?
I checked /etc/security/limits.conf but only these one were present

*               -       rtprio          0
*               -       nice            0
@audio          -       rtprio          65
@audio          -       nice           -10
@audio          -       memlock         40000

cheers,
detto

Offline

#49 2006-08-26 18:22:36

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Forkbomb?

It's not. It's easy enough to put in the relevant setting though.

Offline

#50 2006-08-26 19:22:57

detto
Member
Registered: 2006-01-23
Posts: 510

Re: Forkbomb?

Gullible Jones wrote:

It's not. It's easy enough to put in the relevant setting though.

Mh ok. Easy enough thats true. But why this isnt realized yet to default, i mean it would make not that much work i guess, but pretend those from fork bombs who dont know before how to protect themselves.

cheers,
detto

Offline

Board footer

Powered by FluxBB