<!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>how to restrict a SOCK_RAW by interface</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hello,<BR>
<BR>
I am trying to restrict an application to using only some interfaces on the system. I have defined a new type and assigned the interface on my RHEL5.4-x64 system to the new type with semanage. The system indicates that the interface is now configured.<BR>
&nbsp;&nbsp;&nbsp;&nbsp; # semanage interface -l<BR>
&nbsp;&nbsp;&nbsp;&nbsp; SELinux Interface&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; eth1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system_u:object_r:iface_test_t:s0<BR>
This does restrict applications like tcpdump or wireshark from listing the interface that was configured.<BR>
&nbsp;&nbsp;&nbsp;&nbsp; # tcpdump -D<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 1.peth0<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 2.virbr0<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 3.vif0.0<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 4.eth0<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 5.xenbr0<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 6.eth2<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 7.eth3<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 8.any (Pseudo-device that captures on all interfaces)<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 9.lo<BR>
<BR>
My problem comes that my application can still open eth1 and read and write packets to this interface.<BR>
The application is opening a socket as SOCK_RAW then binding with a struct sockaddr_LL that has the ssll_ifindex field configured with the index of ETH1.<BR>
How do I write a selinux policy to restrict this application from using some interfaces.<BR>
<BR>
<BR>
Thanks<BR>
James Cernak<BR>
&lt;James.Cernak`at`ngc.com&gt;<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>