47 parent::__construct();
55 $this->whitelistedPaths =
array_merge( $this->whitelistedPaths, $paths );
64 if ( $this->restrictions === 0 ) {
65 $splitCommand = explode(
' ',
$command, 2 );
67 "firejail: Command {$splitCommand[0]} {params} has no restrictions",
68 [
'params' => $splitCommand[1] ??
'' ]
70 return parent::buildFinalCommand(
$command );
73 if ( $this->firejail ===
false ) {
74 throw new RuntimeException(
'firejail is enabled, but cannot be found' );
83 $cmd[] =
'--profile=' . __DIR__ .
'/firejail.profile';
89 static $useAllUsers =
null;
90 if ( $useAllUsers ===
null ) {
94 $realIP = realpath(
$IP );
96 $useAllUsers = (
strpos( $realIP,
'/home/' ) === 0 )
97 && (
strpos( $realIP, $currentUser[
'dir'] ) !== 0 );
99 $this->logger->warning(
'firejail: MediaWiki is located ' .
100 'in a home directory that does not belong to the ' .
101 'current user, so allowing access to all home ' .
102 'directories (--allusers)' );
106 if ( $useAllUsers ) {
107 $cmd[] =
'--allusers';
110 if ( $this->whitelistedPaths ) {
112 $cmd[] =
'--whitelist=' . __DIR__ .
'/limit.sh';
113 foreach ( $this->whitelistedPaths as $whitelistedPath ) {
114 $cmd[] =
"--whitelist={$whitelistedPath}";
119 $cmd[] =
'--blacklist=' . realpath( MW_CONFIG_FILE );
130 $extraSeccomp[] =
'execve';
134 $cmd[] =
'--shell=none';
138 $seccomp =
'--seccomp';
139 if ( $extraSeccomp ) {
141 $seccomp .=
'=' . implode(
',', $extraSeccomp );
147 $cmd[] =
'--private-dev';
151 $cmd[] =
'--net=none';
154 $builtCmd = implode(
' ', $cmd );
157 return parent::buildFinalCommand(
"$builtCmd -- {$command}" );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))