From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 5 09:39:49 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7825116A4E5 for ; Wed, 5 Jul 2006 09:39:49 +0000 (UTC) (envelope-from Danovitsch@vitsch.net) Received: from amsfep20-int.chello.nl (amsfep17-int.chello.nl [213.46.243.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55CC443D45 for ; Wed, 5 Jul 2006 09:39:47 +0000 (GMT) (envelope-from Danovitsch@vitsch.net) Received: from Tuinhuisje.Vitsch.net ([62.195.87.223]) by amsfep20-int.chello.nl (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20060705093944.NMMH3918.amsfep20-int.chello.nl@Tuinhuisje.Vitsch.net>; Wed, 5 Jul 2006 11:39:44 +0200 Received: from [192.168.87.6] (f23025.upc-f.chello.nl [80.56.23.25]) (authenticated bits=0) by Tuinhuisje.Vitsch.net (8.13.1/8.13.1) with ESMTP id k659dbDD059131; Wed, 5 Jul 2006 11:39:39 +0200 (CEST) (envelope-from Danovitsch@vitsch.net) From: "Daan Vreeken [PA4DAN]" Organization: Vitsch Electronics To: "mal content" Date: Wed, 5 Jul 2006 11:39:31 +0200 User-Agent: KMail/1.8.2 References: <8e96a0b90607031009v4ec2630fgfc432f5dad15abda@mail.gmail.com> <20060703190448.GD727@turion.vk2pj.dyndns.org> <8e96a0b90607041815s7888cf7areb5244247b9bdb53@mail.gmail.com> In-Reply-To: <8e96a0b90607041815s7888cf7areb5244247b9bdb53@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607051139.32393.Danovitsch@vitsch.net> Cc: freebsd-hackers@freebsd.org Subject: Re: Stop further socket() or connect() calls. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2006 09:39:49 -0000 On Wednesday 05 July 2006 03:15, mal content wrote: > On 03/07/06, Peter Jeremy wrote: > > For dynamic executables, you could LD_PRELOAD a .so that replaces > > all the socket-related syscalls. > > Excellent suggestion! Ok, I've created a basic .so file with the following > code, but I've basically got stuck because I don't know how the original > syscalls are defined and can't find the definitions in the source: > > --- > #include > #include > #include > > int socket(int d, int t, int prot) > { > return __syscall(SYS_socket, d, t, prot); > } > [ ... ] Wouldn't this still allow a program to open sockets when the program does the __syscall() dance for itself instead of relying on socket() to work? I have never tried MAC myself, so correct me if I'm wrong, but I think something like this could be done using a modified version of mac_portacl(4). grtz, Daan