-bash: semanage: command not found

Nginx'i SELinux ile kullanmak için gerekli ayarları yaparken,

$ semanage login -l
-bash: semanage: command not found

uyarısı ile karşılaştım. Ufak bir araştırma ile notumu bırakıyorum. CentOS-7 için:

$ yum provides /usr/sbin/semanage

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netdirekt.com.tr
 * epel: mirrors.mivocloud.com
 * extras: centos.turhost.com
 * updates: centos.turhost.com
policycoreutils-python-2.5-34.el7.x86_64 : SELinux policy core python utilities
Repo        : base
Matched from:
Filename    : /usr/sbin/semanage

hangi paketin semanage için gereklı olduğunu buluyoruz; "policycoreutils-python-2.5-34.el7.x86_64". Bu adımdan sonra paketi yükleyebiliriz.

$ yum install policycoreutils-python

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netdirekt.com.tr
 * epel: mirrors.neterra.net
 * extras: centos.turhost.com
 * updates: centos.turhost.com
Resolving Dependencies
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                                     Arch                        Version                          Repository                 Size
==========================================================================================================================================
Installing:
 policycoreutils-python                      x86_64                      2.5-34.el7                       base                      457 k
Installing for dependencies:
 audit-libs-python                           x86_64                      2.8.5-4.el7                      base                       76 k
 checkpolicy                                 x86_64                      2.5-8.el7                        base                      295 k
 libcgroup                                   x86_64                      0.41-21.el7                      base                       66 k
 libsemanage-python                          x86_64                      2.5-14.el7                       base                      113 k
 python-IPy                                  noarch                      0.75-6.el7                       base                       32 k
 setools-libs                                x86_64                      3.3.8-4.el7                      base                      620 k

Transaction Summary
==========================================================================================================================================
Install  1 Package (+6 Dependent packages)

Total download size: 1.6 M
Installed size: 5.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/7): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                    | 113 kB  00:00:00     
(2/7): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                    |  76 kB  00:00:00     
(3/7): python-IPy-0.75-6.el7.noarch.rpm                                                                            |  32 kB  00:00:00     
(4/7): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                | 457 kB  00:00:00     
(5/7): libcgroup-0.41-21.el7.x86_64.rpm                                                                            |  66 kB  00:00:00     
(6/7): checkpolicy-2.5-8.el7.x86_64.rpm                                                                            | 295 kB  00:00:00     
(7/7): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                         | 620 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                     2.9 MB/s | 1.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libcgroup-0.41-21.el7.x86_64                                                                                           1/7 
  Installing : setools-libs-3.3.8-4.el7.x86_64                                                                                        2/7 
  Installing : audit-libs-python-2.8.5-4.el7.x86_64                                                                                   3/7 
  Installing : python-IPy-0.75-6.el7.noarch                                                                                           4/7 
  Installing : libsemanage-python-2.5-14.el7.x86_64                                                                                   5/7 
  Installing : checkpolicy-2.5-8.el7.x86_64                                                                                           6/7 
  Installing : policycoreutils-python-2.5-34.el7.x86_64                                                                               7/7 
  Verifying  : checkpolicy-2.5-8.el7.x86_64                                                                                           1/7 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                   2/7 
  Verifying  : python-IPy-0.75-6.el7.noarch                                                                                           3/7 
  Verifying  : policycoreutils-python-2.5-34.el7.x86_64                                                                               4/7 
  Verifying  : audit-libs-python-2.8.5-4.el7.x86_64                                                                                   5/7 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                        6/7 
  Verifying  : libcgroup-0.41-21.el7.x86_64                                                                                           7/7 

Installed:
  policycoreutils-python.x86_64 0:2.5-34.el7                                                                                              

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7            checkpolicy.x86_64 0:2.5-8.el7            libcgroup.x86_64 0:0.41-21.el7              
  libsemanage-python.x86_64 0:2.5-14.el7            python-IPy.noarch 0:0.75-6.el7            setools-libs.x86_64 0:3.3.8-4.el7           

Complete!

Kontrol edelim:

$ man semanage

semanage(8)                                                                                                                semanage(8)

NAME
       semanage - SELinux Policy Management tool

SYNOPSIS
       semanage {import,export,login,user,port,interface,module,node,fcontext,boolean,permissive,dontaudit,ibpkey,ibendport}
                       ...  positional arguments:

       import Import local customizations

       export Output local customizations
...
...

CentOS-8 için yüklememiz gerekli paket için syntax ufak bir farklılık gösteriyor:

$ yum install policycoreutils-python-utils

İletişime geçmek, yorum bırakmak veya hatalarımı düzetlmek istersen mail atabilirsin.

iletişim için tıklama yeri