Skip to contentSkip to conversation

squid and apache

DISCUSSION Russell Coker 5 participants 9 messages Mar 2, 2010 – Mar 23, 2010 SELinux security module

lore
Share & tools
lore
#0 lore raw

apache_content_template(squid)

squid.te has the above in an optional section.

/usr/lib/squid/cachemgr\.cgi -- gen_context(system_u:object_r:httpd_squid_script_exec_t,s0)

squid.fc has the above, but there is no facility for optional sections in fc files.

How should we solve this?

Signature · 8 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

--
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 13 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 3 lines

How should we solve this?

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present. What happens to you executable.

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',

    gen_require(`
            type bin_t;
    ')
    typealias bin_t alias backuppc_admin_exec_t;

')

--
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 17 lines · Daniel J Walsh
Quoted 10 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 2 lines

How should we solve this?

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present. What happens to you executable.

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',

Quoted 11 lines
    gen_require(`
            type bin_t;
    ')
    typealias bin_t alias backuppc_admin_exec_t;

')

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.

I do like the idea of the blog though. But it is a little harder then just what you suggest.

Since you will loose httpd_backuppc_content_*t definitions.

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

#4 lore raw
In reply to Daniel J Walsh
Quoted 21 lines · Daniel J Walsh
Quoted 13 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 3 lines

How should we solve this?

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present. What happens to you executable.

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',

Quoted 5 lines
     gen_require(`
             type bin_t;
     ')
     typealias bin_t alias backuppc_admin_exec_t;

')

That won't work because you can't put require blocks in the else block of an optional.

Signature · 10 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150



--
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
Quoted 33 lines · Christopher J. PeBenito
Quoted 25 lines · Daniel J Walsh
Quoted 8 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 4 lines

How should we solve this?

Quoted 8 lines

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present. What happens to you executable.

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',

Quoted 6 lines
      gen_require(`
              type bin_t;
      ')
      typealias bin_t alias backuppc_admin_exec_t;

')

Quoted 4 lines

That won't work because you can't put require blocks in the else block of an optional.

Could you fool the compiler by putting an interface with a gen_require

corecmd_bin_alias(backuppc_admin_exec_t)

Probably not.

--
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
In reply to Christopher J. PeBenito
Quoted 29 lines · Christopher J. PeBenito
Quoted 17 lines · Daniel J Walsh
Quoted 13 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 3 lines

How should we solve this?

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present.  What happens to you executable.

Quoted 9 lines

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',
     gen_require(`
             type bin_t;
     ')
     typealias bin_t alias backuppc_admin_exec_t; ')

Quoted 3 lines

That won't work because you can't put require blocks in the else block of an optional.

Thought I'd mention that the proposed CIL would alleviate this problem since it allows you to put FC statements in the policy (and in conditional statements). For example:

# if the squid block exists (i.e., the squid module is in the policy)
IF (? /(BLOCK squid)) {
  # call the apache block with the squid type
  CALL /(BLOCK apache_content_template) (TYPE squid)
  # label the squid cache manager
  LABEL (PATH:FILE (PATH:REGEX "/usr/lib/squid/cachemgr\.cgi")
(PATH:FILETYPE "--")) {
     USER system
     ROLE object
     TYPE squid_script_exec
     RANGE (LEVEL s0)
  }
}

The syntax is probably going to be changed at some point, but this does illustrate the general concept that labeling is part of the policy language proper and can be used in conditionals.

Caleb

--
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
Quoted 59 lines · Caleb Case
Quoted 33 lines · Christopher J. PeBenito
Quoted 25 lines · Daniel J Walsh
Quoted 8 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 4 lines

How should we solve this?

Quoted 8 lines

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

Dominic your example would not work since it would not have rules to handle apache content is not present. What happens to you executable.

I am not sure this would work.
optional_policy( apache_cgi_domain(backuppc_admin_t, backuppc_admin_exec_t) ',

Quoted 6 lines
      gen_require(`
              type bin_t;
      ')
      typealias bin_t alias backuppc_admin_exec_t;

')

Quoted 4 lines

That won't work because you can't put require blocks in the else block of an optional.

Thought I'd mention that the proposed CIL would alleviate this problem since it allows you to put FC statements in the policy (and in conditional statements). For example:

# if the squid block exists (i.e., the squid module is in the policy)
IF (? /(BLOCK squid)) {
   # call the apache block with the squid type
   CALL /(BLOCK apache_content_template) (TYPE squid)
   # label the squid cache manager
   LABEL (PATH:FILE (PATH:REGEX "/usr/lib/squid/cachemgr\.cgi")
(PATH:FILETYPE "--")) {
      USER system
      ROLE object
      TYPE squid_script_exec
      RANGE (LEVEL s0)
   }
}
Quoted 6 lines

The syntax is probably going to be changed at some point, but this does illustrate the general concept that labeling is part of the policy language proper and can be used in conditionals.

Caleb

Well since you brought it up, I believe there should be an alias in here.

So if this policy is installed you have squid_script_exec_t otherwise alias all files to bin_t. So the system can work if the policy is enabled or disabled.

All file types defined in policy should have an alias for enabled and disabled policy.

Even if they default to default_t.

--
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
In reply to Dominick Grift
Quoted 10 lines · Dominick Grift

On 03/03/2010 12:07 AM, Russell Coker wrote:
<snip>

Quoted 1 line

How should we solve this?

I Wrote a blog with my view on this issue here:

http://selinux-mac.blogspot.com/2010/02/about-apachecontenttemplate.html

I am also interested in other views on this.

I've attached the patch I'm using for Debian/Squeeze.

Signature · 3 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog