<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: how to restrict a SOCK_RAW by interface</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hello,<BR>
<BR>
Thanks for the hint, However it does not solve my problem I still can read from eth0.<BR>
<BR>
I did have to add allow rules for netif_t:netif but my policy still does not allow iface_test_t.<BR>
<BR>
James<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Stephen Smalley [<A HREF="mailto:sds@tycho.nsa.gov">mailto:sds@tycho.nsa.gov</A>]<BR>
Sent: Mon 12/14/2009 1:49 PM<BR>
To: Cernak, James E (IS)<BR>
Cc: fedora-selinux-list@redhat.com<BR>
Subject: Re: how to restrict a SOCK_RAW by interface<BR>
<BR>
On Mon, 2009-12-14 at 13:29 -0600, Cernak, James E (IS) wrote:<BR>
> Hello,<BR>
><BR>
> I am trying to restrict an application to using only some interfaces<BR>
> on the system. I have defined a new type and assigned the interface on<BR>
> my RHEL5.4-x64 system to the new type with semanage. The system<BR>
> indicates that the interface is now configured.<BR>
>      # semanage interface -l<BR>
>      SELinux Interface              Context<BR>
><BR>
>      eth1                           system_u:object_r:iface_test_t:s0<BR>
> This does restrict applications like tcpdump or wireshark from listing<BR>
> the interface that was configured.<BR>
>      # tcpdump -D<BR>
>      1.peth0<BR>
>      2.virbr0<BR>
>      3.vif0.0<BR>
>      4.eth0<BR>
>      5.xenbr0<BR>
>      6.eth2<BR>
>      7.eth3<BR>
>      8.any (Pseudo-device that captures on all interfaces)<BR>
>      9.lo<BR>
><BR>
> My problem comes that my application can still open eth1 and read and<BR>
> write packets to this interface.<BR>
> The application is opening a socket as SOCK_RAW then binding with a<BR>
> struct sockaddr_LL that has the ssll_ifindex field configured with the<BR>
> index of ETH1.<BR>
> How do I write a selinux policy to restrict this application from<BR>
> using some interfaces.<BR>
><BR>
<BR>
In RHEL5 (Linux 2.6.18), you might need to enable compat_net (echo 1<BR>
> /selinux/compat_net or boot with selinux_compat_net=1 on the kernel<BR>
command line).<BR>
<BR>
--<BR>
Stephen Smalley<BR>
National Security Agency<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>