Skip to contentSkip to conversation

Centos 5 OpenVPN / SElinux

DISCUSSION Bernd Bartmann 3 participants 4 messages May 30, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

I'm running Centos 5 32bit and installed openvpn-2.0.9-1.el5.rf from Dag Wieers Repo. When OpenVPN is started during boot-up it just shows an SElinux related error message. When I start OpenVPN manually after the system has come up completely it works fine.

Here are all the messages from /var/log/messages that are SElinux related:

May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:10): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:11): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:12): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.458:13): avc:
denied  { execstack } for  pid=3012 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:14): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:15): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:16): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.466:17): avc:
denied  { execstack } for  pid=3014 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:40:06 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 21:40:06 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:10): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:11): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:12): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.382:13): avc:
denied  { execstack } for  pid=3010 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:14): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:15): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:16): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:17): avc:
denied  { execstack } for  pid=3012 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:05 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:05 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:56:42 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:56:42 srsblnfw01 setroubleshoot:      SELinux is preventing

/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t). For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0

In Centos4 one could enable / disable SElinux for certain services using system-config-securitylevel. This is not possible anymore in Centos5. One can only either enable or disable SElinux completely.

Any ideas how to fix the problem so that OpenVPN starts-up correctly during boot-up?

Best regards,
Bernd

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 146 lines · Bernd Bartmann

Hi,

I'm running Centos 5 32bit and installed openvpn-2.0.9-1.el5.rf from Dag Wieers Repo. When OpenVPN is started during boot-up it just shows an SElinux related error message. When I start OpenVPN manually after the system has come up completely it works fine.

Here are all the messages from /var/log/messages that are SElinux related:

May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:10): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:11): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.395:12): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.458:13): avc:
denied  { execstack } for  pid=3012 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:14): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:15): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.465:16): avc:
denied  { use } for  pid=3014 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:39:15 srsblnfw01 kernel: audit(1180381151.466:17): avc:
denied  { execstack } for  pid=3014 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:40:06 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 21:40:06 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:10): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:11): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.319:12): avc:
denied  { use } for  pid=3010 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.382:13): avc:
denied  { execstack } for  pid=3010 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:14): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:15): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:16): avc:
denied  { use } for  pid=3012 comm="openvpn" name="null" dev=tmpfs
ino=1396 scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:pppd_t:s0 tclass=fd
May 28 21:44:26 srsblnfw01 kernel: audit(1180381461.390:17): avc:
denied  { execstack } for  pid=3012 comm="openvpn"
scontext=system_u:system_r:openvpn_t:s0
tcontext=system_u:system_r:openvpn_t:s0 tclass=process
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:18:52 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:26:00 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "use" access to /dev/null (pppd_t).
For complete SELinux messages. run sealert -l
5701a4da-1d96-4c86-9747-e31b3d5d2219
May 28 22:42:03 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:05 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:42:05 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:56:42 srsblnfw01 setroubleshoot:      SELinux is preventing
/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t).      For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0
May 28 22:56:42 srsblnfw01 setroubleshoot:      SELinux is preventing

/usr/sbin/openvpn (openvpn_t) "execstack" access to <Unknown>
(openvpn_t). For complete SELinux messages. run sealert -l
0b738097-f92a-44c4-952b-7247d88a40e0

Quoted 6 lines

In Centos4 one could enable / disable SElinux for certain services using system-config-securitylevel. This is not possible anymore in Centos5. One can only either enable or disable SElinux completely.

Any ideas how to fix the problem so that OpenVPN starts-up correctly during boot-up?

Easiest thing to do is update policy with these two rules.

# grep openvpn /var/log/audit/audit.log | audit2allow -M myopenvpn
# semodule -i myopenvpn.pp

This will add the following rules:
allow openvpn_t pppd_t:fd use;
allow openvpn_t self:process execstack;

The pppd_t:fd is probably a leaked file descriptor and could probably be dontaudited.
The execstack is potentially a problem in openvpn_t. This is probably a coding problem and should be reported as a bug/

SELinux Memory Protection Tests <http://people.redhat.com/%7Edrepper/selinux-mem.html>

Quoted 8 lines

Best regards,
Bernd

Signature · 3 lines
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 5 lines · Daniel J Walsh

Easiest thing to do is update policy with these two rules.

# grep openvpn /var/log/audit/audit.log | audit2allow -M myopenvpn
# semodule -i myopenvpn.pp
Quoted 8 lines

This will add the following rules:
allow openvpn_t pppd_t:fd use;
allow openvpn_t self:process execstack;

The pppd_t:fd is probably a leaked file descriptor and could probably be dontaudited.
The execstack is potentially a problem in openvpn_t. This is probably a coding problem and should be reported as a bug/

Daniel, do you mean a bug in SElinux or OpenVPN?

Best regards,
Bernd.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 10 lines · Bernd Bartmann
Quoted 9 lines · Daniel J Walsh

Easiest thing to do is update policy with these two rules.

# grep openvpn /var/log/audit/audit.log | audit2allow -M myopenvpn
# semodule -i myopenvpn.pp

This will add the following rules:
allow openvpn_t pppd_t:fd use;
allow openvpn_t self:process execstack;

Quoted 6 lines
Quoted 4 lines

The pppd_t:fd is probably a leaked file descriptor and could probably be dontaudited.
The execstack is potentially a problem in openvpn_t. This is probably a coding problem and should be reported as a bug/

Daniel, do you mean a bug in SElinux or OpenVPN?

OpenVPN. See Ulrich Drepper's description of the selinux memory protection tests, particularly the execstack description.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.