Ready for 0.002

This commit is contained in:
Ryan Voots 2017-05-03 23:30:32 -07:00
parent 7387a1eede
commit 837ff8fc21
3 changed files with 33 additions and 4 deletions

8
Changes Normal file
View file

@ -0,0 +1,8 @@
Revision history for Sys::Linux::Namespaces
0.002 - May 3 2017
* Added a number of more namespace options
* Corrected dependency on EUMM
0.001 - May 3 2017
* Initial release

View file

@ -24,4 +24,5 @@ WriteMakefile_arg = | XSMULTI => 1
[Git::NextVersion] [Git::NextVersion]
[AutoPrereqs] [AutoPrereqs]
[Prereqs] [Prereqs]
-phase = configure
ExtUtils::MakeMaker=7.12 ExtUtils::MakeMaker=7.12

View file

@ -11,10 +11,10 @@ use POSIX qw/_exit/;
use Moo; use Moo;
use Carp qw/carp/; use Carp qw/carp/;
has private_tmp => (is => 'rw'); for my $p (qw/tmp mount pid net ipc user uts sysvsem/) {
has private_mount => (is => 'rw'); my $pp = "private_$p";
has private_pid => (is => 'rw'); has $pp => (is => 'rw');
has private_net => (is => 'rw'); }
has code => (is => 'rw'); # code to run in the namespace has code => (is => 'rw'); # code to run in the namespace
@ -25,6 +25,10 @@ sub _uflags {
$uflags |= CLONE_NEWNS if ($self->private_tmp || $self->private_mount); $uflags |= CLONE_NEWNS if ($self->private_tmp || $self->private_mount);
$uflags |= CLONE_NEWPID if ($self->private_pid); $uflags |= CLONE_NEWPID if ($self->private_pid);
$uflags |= CLONE_NEWNET if ($self->private_net); $uflags |= CLONE_NEWNET if ($self->private_net);
$uflags |= CLONE_NEWIPC if ($self->private_ipc);
$uflags |= CLONE_NEWUSER if ($self->private_user);
$uflags |= CLONE_NEWUTS if ($self->private_uts);
$uflags |= CLONE_SYSVSEM if ($self->private_sysvsem);
return $uflags; return $uflags;
} }
@ -188,6 +192,22 @@ Create a private PID namespace. This requires a C<code> parameter either to C<n
TODO This is not yet implemented. Once done however, it will allow a child process to execute with a private network preventing communication. Will require a C<code> parameter to C<new()> or C<setup>. TODO This is not yet implemented. Once done however, it will allow a child process to execute with a private network preventing communication. Will require a C<code> parameter to C<new()> or C<setup>.
=item C<private_ipc>
Create a private IPC namespace.
=item C<private_user>
Create a new user namespace. See C<man 7 user_namespaces> for more information.
=item C<private_uts>
Create a new UTS namespace. This will let you safely change the hostname of the system without affect anyone else.
=item C<private_sysvsem>
Create a new System V Semaphore namespace. This will let you create new semaphores without anyone else touching them.
=back =back
=head1 AUTHOR =head1 AUTHOR