All of lore.kernel.org
 help / color / mirror / Atom feed
From: KaiGai Kohei <kaigai@ak.jp.nec.com>
To: Daniel J Walsh <dwalsh@redhat.com>
Cc: Joshua Brindle <jbrindle@tresys.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	selinux@tycho.nsa.gov, Eamon Walsh <ewalsh@tycho.nsa.gov>
Subject: Re: PHP/SELinux: libselinux wrappers
Date: Tue, 10 Mar 2009 16:05:48 +0900	[thread overview]
Message-ID: <49B6114C.8040704@ak.jp.nec.com> (raw)
In-Reply-To: <49ACA5FE.8000804@ak.jp.nec.com>

Hi,

http://koji.fedoraproject.org/koji/packageinfo?packageID=7917

Now the "php-pecl-selinux" package got approved in Fedora Project.
Some days later, it will be delivered to mirrors.

KaiGai Kohei wrote:
 > Now it in PECL repository:
 >   http://pecl.php.net/package/selinux
 >   http://cvs.php.net/viewvc.cgi/pecl/selinux/

BTW, I still mark its state as "devel". It means we have a possibility
to change APIs. If you found anything to be improved, please tell me.


The following example is just a toy, which implements
Paul's "getpeercon_server.c" example in PHP.
--------------
#!/usr/bin/php -q
<?
if (count($argv) < 2) {
     echo "usage: ".$argv[0]." <port>\n";
     return 1;
}

$conn_url = sprintf("tcp://0.0.0.0:%u", $argv[1]);
$server = stream_socket_server($conn_url, $errno, $errmsg);
if (!$server) {
     echo "error: $errmsg ($errno)\n";
     return 1;
}

while (($client = stream_socket_accept($server))) {
     $ipaddr = stream_socket_get_name($client, true);
     $peercon = selinux_getpeercon($client);
     printf("connect %s => %s\n", $ipaddr, !$peercon ? "null" : $peercon);
     fclose($client);
}
fclose($server);
?>
--------------

   [kaigai@saba ~]$ ./peersock.php 1234
   connect 10.19.71.82:4643 => user_u:user_r:user_t:s0
   connect 127.0.0.1:36277 => staff_u:staff_r:staff_t:s0
   connect 10.19.71.81:48902 => null

I guess it also can be used for education purpose because it enables
to observe the behavior of SELinux with quick try-and-error steps. :-)

Thanks,

> It is necessary the package to be reviewed whether the specfile
> correctly follows Fedora packaging guideline [1] [2], or not.
> I would like folks to help reviewing it.
> 
> In addition, Fedora Project requires all the new packages
> to be approved by core maintainers called as "sponsor" [3].
> 
> Could you introduce me an appropriate person to recommend
> the package?
> 
> Thanks,
> 
> [1] http://fedoraproject.org/wiki/Packaging/Guidelines
> [2] http://fedoraproject.org/wiki/Packaging/PHP
> [3] 
> https://admin.fedoraproject.org/accounts/group/members/packager/*/sponsor
> 
> Daniel J Walsh wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> KaiGai Kohei wrote:
>>> Joshua Brindle wrote:
>>>>> -----Original Message-----
>>>>> From: Daniel J Walsh [mailto:dwalsh@redhat.com]
>>>>>
>>>>> I would rather package this up as part of libselinux, perhaps
>>>>> libselinux-php, rather then make a new package.
>>>> The last time I used PHP (admittedly years ago) most if not all 
>>>> bindings
>>>> were included in the upstream PHP distribution.
>>> At least, most of PHP extensions has php-* naming convension, like:
>>>   php-mysql, php-mbstring, php-ldap, ...
>>>
>>> Most of major extensions are distributed as subpackages of php itself,
>>> but some of extensions are not distributed as separated package.
>>> (Please find php-* on the list of Fedora SRPMs.)
>>>
>>> I don't think we need to wait for it get merged into the core PHP,
>>> to release php-selinux package.
>>>
>>> Thanks,
>> Ok then fine leave it as a separate package.
> 


-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2009-03-10  7:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09  6:41 PHP/SELinux: libselinux wrappers KaiGai Kohei
2008-09-18  2:25 ` KaiGai Kohei
2009-02-26  6:22 ` KaiGai Kohei
2009-02-26 14:39   ` Stephen Smalley
2009-02-26 14:57     ` Daniel J Walsh
2009-02-26 18:50       ` Joshua Brindle
2009-02-27  2:23         ` KaiGai Kohei
2009-02-27 19:08           ` Daniel J Walsh
2009-03-03  3:37             ` KaiGai Kohei
2009-03-10  7:05               ` KaiGai Kohei [this message]
2009-02-27  2:10       ` KaiGai Kohei
2009-02-27  1:56     ` KaiGai Kohei
2009-02-27  4:28       ` KaiGai Kohei
2009-02-27  8:40         ` KaiGai Kohei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49B6114C.8040704@ak.jp.nec.com \
    --to=kaigai@ak.jp.nec.com \
    --cc=dwalsh@redhat.com \
    --cc=ewalsh@tycho.nsa.gov \
    --cc=jbrindle@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.