The OpenNET Project
 
Search (keywords):  SOFT ARTICLES TIPS & TRICKS SECURITY
LINKS NEWS MAN DOCUMENTATION


limit maximum nr. of processes.


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Date: Wed, 1 Sep 1999 10:53:48 +0200
From: "Petter Wahlman <[email protected]>" <[email protected]>
To: [email protected]
Subject: limit maximum nr. of processes.

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to [email protected] for more info.

--1203880212-1746911278-936176028=:26470
Content-Type: TEXT/PLAIN; charset=US-ASCII

'lo!

i have made a loadable kernel module that lets you limit the maximum
number of processes members of the group USER_GID can execute.
this can e.g be used to prevent DoS attacks like:

int main()
{
 while(1) fork();
 return 1;
}

Setting the limit is easily done through the proc interface:

arjuna(root):fork~>cat /proc/maxprocs
gid: 500 restricted to: 40 processes

arjuna(root):fork~>echo 64 > /proc/maxprocs

arjuna(root):fork~>cat /proc/maxprocs
gid: 500 restricted to: 64 processes

[The module does currently only support v.2.2.X of the Linux kernel.]

________________________________________________________________________________
Petter Wahlman
[email protected]

#define QUESTION ((bb) || !(bb))  - Shakespeare.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA6E616D6C68615720726574746550snlbxq'|dc
________________________________________________________________________________

--1203880212-1746911278-936176028=:26470
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="foo.c"
Content-Transfer-Encoding: BASE64
Content-ID: <[email protected]>
Content-Description:
Content-Disposition: attachment; filename="foo.c"

LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKg0KICogc2VjZm9yayB2MS4wYSAtIHBldHRl
ciB3YWhsbWFuIDxiYWN0dXNAc29sLm5vPiANCiAqIA0KICogTGltaXQgdGhl
IG1heGltdW0gbnVtYmVyIG9mIHByb2Nlc3NlcyBtZW1iZXJzDQogKiBvZiB0
aGUgZ3JvdXAgVVNFUl9HSUQgY2FuIGV4ZWN1dGUu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cmtdOw0KIHN5c19jYWxsX3RhYmxlW19fTlJfZm9ya10gPSBu
ZXdfZm9yazsNCg0KIHJldHVybiBwcm9jX3JlZ2lzdGVyKCZwcm9jX3Jvb3Qs
ICZwcm9jX2VudHJ5KTsNCn0NCg0Kdm9pZCBjbGVhbnVwX21vZHVsZSh2b2lk
KQ0Kew0KIAlzeXNfY2FsbF90YWJsZVtfX05SX2ZvcmtdID0gb2xkX2Zvcms7
DQoJcHJvY191bnJlZ2lzdGVyKCZwcm9jX3Jvb3QsIHByb2NfZW50cnkubG93
X2lubyk7DQoJcHJpbnRrKCJzZWNmb3JrIHVubG9hZGVkLi5cbiIpOw0KfSAN
Cg==
--1203880212-1746911278-936176028=:26470--

<< Previous INDEX Search src Set bookmark Go to bookmark Next >>



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру