Skip to contentSkip to conversation

Developing a SELinux policy for antivirus - Activating a boolean variable when another has been actived

DISCUSSION Alice Mynona 5 participants 14 messages Jun 24, 2010 – Jun 25, 2010 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Thanks in advance.

Best regards,
Alice

--
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

Can you post you te file?

Ted

Quoted 25 lines · Alice Mynona

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Thanks in advance.

Quoted 8 lines

Best regards,
Alice

--
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

Thanks for your answer.

Xavier Toth schrieb am 24.06.2010 17:35 Uhr:

Quoted 2 lines

Can you post you te file?

Unfortunately not. I was just testing something. After the removal of the module, I have deleted the files. I have noticed the error described in my last posting a few hours later. Next time I will backup files for testing purposes, too.

Best regards,

Alice

Quoted 31 lines

Ted

Quoted 28 lines · Alice Mynona

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Thanks in advance.

Best regards,
Alice

--
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
In reply to Alice Mynona
Quoted 1 line · Alice Mynona

I have also taken a look at "file_contexts" (cd

/etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

antivirus_t is defined a domain type so you wont find it in the list of file contexts because those are file types.

does sesearch --allow -s antivirus_t return anything or sesearch --allow -t antivirus_t?

and:

semanage fcontext -l | grep antivirus

and

semodule -l | grep antivirus

#4 lore raw

Thanks for your answer.

Dominick Grift schrieb am 24.06.2010 18:14 Uhr:

Quoted 8 lines · Alice Mynona
Quoted 1 line

I have also taken a look at "file_contexts" (cd

/etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

antivirus_t is defined a domain type so you wont find it in the list of file contexts because those are file types.

stupid ;-) It's late. Of course, you are right.

Quoted 1 line

does sesearch --allow -s antivirus_t return anything

ERROR: could not find datum for type antivirus_t

Quoted 1 line

or sesearch --allow -t antivirus_t?

ERROR: could not find datum for type antivirus_t

Quoted 4 lines

and:

semanage fcontext -l | grep antivirus

No matches.

Quoted 5 lines

and

semodule -l | grep antivirus

No matches.

It's funny, isn't it?

Best regards,

Alice

--
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.

#5 lore raw
In reply to Alice Mynona
Quoted 15 lines · Alice Mynona

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

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.
#6 lore raw
Quoted 31 lines · Stephen Smalley
Quoted 15 lines · Alice Mynona

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

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.
#7 lore raw

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

--
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.

#8 lore raw
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 5 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.

#9 lore raw
Quoted 71 lines · Dominick Grift
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

Quoted 17 lines

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 5 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.

Yes I want the analysis to show up in audit2allow, If libsemanage would just shut up, we really should ignore the errors.

--
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.

#10 lore raw
Quoted 83 lines · Daniel J Walsh
Quoted 82 lines · Dominick Grift
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 4 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.

Yes I want the analysis to show up in audit2allow, If libsemanage would just shut up, we really should ignore the errors.

Then use semanage_msg_set_callback(hnd, NULL, NULL);

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.
#11 lore raw
Quoted 90 lines · Stephen Smalley
Quoted 89 lines · Daniel J Walsh
Quoted 88 lines · Dominick Grift
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 5 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.

Quoted 4 lines
Quoted 2 lines

Yes I want the analysis to show up in audit2allow, If libsemanage would just shut up, we really should ignore the errors.

Then use semanage_msg_set_callback(hnd, NULL, NULL);

Actually I think you want sepol_msg_set_callback() since audit2why is directly using libsepol, right?

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.
#12 lore raw
Quoted 91 lines · Stephen Smalley
Quoted 90 lines · Stephen Smalley
Quoted 89 lines · Daniel J Walsh
Quoted 88 lines · Dominick Grift
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 5 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.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Yes I want the analysis to show up in audit2allow, If libsemanage would just shut up, we really should ignore the errors.

Then use semanage_msg_set_callback(hnd, NULL, NULL);

Actually I think you want sepol_msg_set_callback() since audit2why is directly using libsepol, right?

Python does not have this binding...

--
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.

#13 lore raw
Quoted 95 lines · Daniel J Walsh
Quoted 94 lines · Stephen Smalley
Quoted 93 lines · Stephen Smalley
Quoted 91 lines · Daniel J Walsh
Quoted 71 lines · Dominick Grift
Quoted 58 lines · Alice Mynona

Stephen Smalley schrieb am 24.06.2010 19:33 Uhr:

Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Alice Mynona
Quoted 15 lines

Hello,

during the developing of a SELinux module I got the following error messages when executing "audit2allow -a -l"

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid

"antivirus_t" is a domain I have defined in my module:

type antivirus_t;
domain_type(antivirus_t)

Quoted 7 lines

I have already removed the module (semodule -r antivirus.pp && semodule -R) and did a file context repair afterwards (fixfiles restore). The error still exists.

I have reinstalled the policy (yum reinstall selinux-policy-*), but the problem remains. I have also taken a look at "file_contexts" (cd /etc/selinux/targeted/modules/active && grep antivirus_t file_contexts*), but there's no "antivirus_t" anymore.

Can you help me to find the cause of the problem? I don't know how to debug libsepol-messages.

I'm using "selinux-policy-targeted-3.6.32-118.fc12.noarch".

Sounds like the -l option to audit2allow isn't working correctly, so that instead of only processing audit messages since the last policy reload, you are still processing the audit messages from when that policy module was installed, and unsurprisingly it cannot map those contexts since you removed the module. That would be a bug in audit2allow/sepolgen.

Quoted 4 lines
Quoted 3 lines

Workaround would be to use ausearch to select the desired range of messsages specifically, e.g.
/sbin/ausearch -m AVC -ts today | audit2allow

I did a reload today at 08:36:00 a.m. (semodule -R). Round about two and half hours later I checked the auditlog:

ausearch -m AVC --start 25.06.2010 08:36:00 --end 25.06.2010 11:00:00

Only messages from ssh_t (success=yes). Fine. But "audit2allow -a -l" still throws error messages:

...
libsepol.context_from_record: type antivirus_t is not defined libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert unconfined_u:unconfined_r:antivirus_t:s0 to sid
...

Quoted 4 lines

Dan - looks like you pushed the audit2why analyze calls down into sepolgen while it is parsing the messages. But this means that all messages will be analyzed even if the user specified -l.

I will wait for Dan's answer :-).

Quoted 8 lines

Problem solved. @All: Thanks for your help.

Best regards,

Alice

p.s.:
I still don't know how to debug sepol-messages. Can you give me a hint?

I think it is not just with the -l option as i had similar output today by using plain ausearch -m avc -ts recent | audit2allow:

Quoted 17 lines

libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023" libsepol.context_from_record: could not create context structure libsepol.context_from_string: could not create context structure libsepol.sepol_context_to_sid: could not convert staff_u:staff_r:mozilla_t:s0-s0:c0.c1023 to sid libsepol.context_from_record: invalid security context:
"staff_u:staff_r:mozilla_t:s0-s0:c0.c1023"

Quoted 5 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.

Yes I want the analysis to show up in audit2allow, If libsemanage would just shut up, we really should ignore the errors.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Then use semanage_msg_set_callback(hnd, NULL, NULL);

Actually I think you want sepol_msg_set_callback() since audit2why is directly using libsepol, right?

Python does not have this binding...

Ok, add it ;)

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.