Lorsque je rédigeais un article sur l'installation de MongoDB sur CentOS , j'ai dû exécuter la commande semanage pour apporter une modification à SELinux politique pour nous autoriser l'accès à MongoDB sur le port 27017.
semanage port -a -t mongod_port_t -p tcp 27017
À ma grande surprise, j'ai eu une erreur.
-bash: semanage: command not found
semanage est utilisé pour configurer certaines parties de la politique SELinux sans nécessiter de modification ou de recompilation à partir des sources de politique.
Ce petit article vous aidera à installer les packages nécessaires pour obtenir la commande semanage. Voyons quel paquet nous fournit la commande ifconfig en utilisant le YUM commande.
yum whatprovides semanage
OU
yum provides *bin/semanage
Sortie :
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iitm.ac.in * extras: ftp.iitm.ac.in * updates: ftp.iitm.ac.in base/7/x86_64/filelists_db | 6.7 MB 00:00:01 extras/7/x86_64/filelists_db | 528 kB 00:00:00 nginx/x86_64/filelists_db | 39 kB 00:00:00 updates/7/x86_64/filelists_db | 3.1 MB 00:00:00 policycoreutils-python-2.5-17.1.el7.x86_64 : SELinux policy core python utilities Repo : base Matched from: Filename : /usr/sbin/semanage
À partir de la sortie de la commande ci-dessus, vous pouvez voir que le package policycoreutils-python vous fournit la commande semanage . Maintenant, installez le package policycoreutils-python en utilisant le YUM commande.
yum -y install policycoreutils-python
Sortie :
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iitm.ac.in * extras: ftp.iitm.ac.in * updates: ftp.iitm.ac.in Resolving Dependencies --> Running transaction check ---> Package policycoreutils-python.x86_64 0:2.5-17.1.el7 will be installed --> Processing Dependency: setools-libs >= 3.3.8-1 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libsemanage-python >= 2.5-5 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Running transaction check ---> Package audit-libs-python.x86_64 0:2.7.6-3.el7 will be installed ---> Package checkpolicy.x86_64 0:2.5-4.el7 will be installed ---> Package libcgroup.x86_64 0:0.41-13.el7 will be installed ---> Package libsemanage-python.x86_64 0:2.5-8.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-1.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Installing: policycoreutils-python x86_64 2.5-17.1.el7 base 446 k Installing for dependencies: audit-libs-python x86_64 2.7.6-3.el7 base 73 k checkpolicy x86_64 2.5-4.el7 base 290 k libcgroup x86_64 0.41-13.el7 base 65 k libsemanage-python x86_64 2.5-8.el7 base 104 k python-IPy noarch 0.75-6.el7 base 32 k setools-libs x86_64 3.3.8-1.1.el7 base 612 k Transaction Summary =========================================================================================================== Install 1 Package (+6 Dependent packages) Total download size: 1.6 M Installed size: 5.1 M Downloading packages: (1/7): audit-libs-python-2.7.6-3.el7.x86_64.rpm | 73 kB 00:00:00 (2/7): libsemanage-python-2.5-8.el7.x86_64.rpm | 104 kB 00:00:00 (3/7): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00 (4/7): checkpolicy-2.5-4.el7.x86_64.rpm | 290 kB 00:00:00 (5/7): setools-libs-3.3.8-1.1.el7.x86_64.rpm | 612 kB 00:00:00 (6/7): policycoreutils-python-2.5-17.1.el7.x86_64.rpm | 446 kB 00:00:00 (7/7): libcgroup-0.41-13.el7.x86_64.rpm | 65 kB 00:00:01 ----------------------------------------------------------------------------------------------------------- Total 1.4 MB/s | 1.6 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : setools-libs-3.3.8-1.1.el7.x86_64 1/7 Installing : checkpolicy-2.5-4.el7.x86_64 2/7 Installing : libcgroup-0.41-13.el7.x86_64 3/7 Installing : python-IPy-0.75-6.el7.noarch 4/7 Installing : audit-libs-python-2.7.6-3.el7.x86_64 5/7 Installing : libsemanage-python-2.5-8.el7.x86_64 6/7 Installing : policycoreutils-python-2.5-17.1.el7.x86_64 7/7 Verifying : libsemanage-python-2.5-8.el7.x86_64 1/7 Verifying : audit-libs-python-2.7.6-3.el7.x86_64 2/7 Verifying : python-IPy-0.75-6.el7.noarch 3/7 Verifying : policycoreutils-python-2.5-17.1.el7.x86_64 4/7 Verifying : libcgroup-0.41-13.el7.x86_64 5/7 Verifying : checkpolicy-2.5-4.el7.x86_64 6/7 Verifying : setools-libs-3.3.8-1.1.el7.x86_64 7/7 Installed: policycoreutils-python.x86_64 0:2.5-17.1.el7 Dependency Installed: audit-libs-python.x86_64 0:2.7.6-3.el7 checkpolicy.x86_64 0:2.5-4.el7 libcgroup.x86_64 0:0.41-13.el7 libsemanage-python.x86_64 0:2.5-8.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-1.1.el7 Complete!
Une fois l'installation terminée, exécutez semanage pour voir s'il est disponible ou non.
semanage port -a -t mongod_port_t -p tcp 27017
Maintenant, vous ne devriez plus voir d'erreurs.
C'est tout.