mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Benie <peterb@chiark.greenend.org.uk>
To: linux-kernel@vger.kernel.org
Subject: Re: Unauthorized connection blocking withing socket
Date: Sun, 13 Jan 2002 13:38:51 +0000	[thread overview]
Message-ID: <E16PkqZ-00085N-00@chiark.greenend.org.uk> (raw)
In-Reply-To: <3C40B526.D960AC26@nbnet.nb.ca>
In-Reply-To: <3C40B526.D960AC26@nbnet.nb.ca>

In article <3C40B526.D960AC26@nbnet.nb.ca> you write:
>Hi,
>
>Currently I am working on a project which intends to stop unauthorized
>processes sending emails or messages to the internet. The goal of the
>project  is to tackle  the Distributed Service Denial problem.
>
>From the experience on telecommunication at socket level,  it is natural
>for me to look at sys_connect().
>My idea is that: every time when a process tries to make a connection,
>the kernel checks whether the process has the permission to make such
>connection. It requires:
>1. The identification of the process.  I chose the absolute path since
>it is unique, can't be tempted.

Identification of processes is hard. Even if you identify which
program was execed (eg. via /proc/<pid>/exe), that doesn't help
you. For example, if I set LD_PRELOAD or LD_LIBRARY_PATH to cause the
program to link with a library that I control, then I have complete
control over what code gets run. Alternatively, I can control the
process by attaching to it with ptrace. 

If you're going to stick with something approximating unix, then you
can prevent tampering by making the program privileged (eg. by making
the program setuid). Having done that, you're in a much better
position to enforce policy. You can use netfilter to firewall out
connections to port 25 from your users, and to enable the privileged
user (ie. the uid used by your MTA during remote deliveries) to make
connections.

>2. A config file which contains connection rules for processes.
>Currently, there are  only two fields in a connection rule: <cmd path>
>and  <ip mask> e.g.
>    # <cmdpath>     <mask>
>    /home/stao/test1        192.168.2.2
>    /usr/bin/ftp    255.255.255.255
>
>where test1 can connect any port on local host 192.168.2.2 and ftp can
>connect to ports of any ip address.

Access control based on program filenames in unix is in the class of
problems where you "don't start from here." The mechanisms used by
unix for access control are almost entirely based on uids and gids,
and you are much better off working within this constraint. If you
don't, you may end up with code that's very hard to check for
correctness. 

Peter

      parent reply	other threads:[~2002-01-13 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-12 22:13 Senhua Tao
2002-01-13  1:17 ` Alan Cox
2002-01-13 13:38 ` Peter Benie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E16PkqZ-00085N-00@chiark.greenend.org.uk \
    --to=peterb@chiark.greenend.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®