"semanage port"コマンドが機能しない

したがって、私の仕事はCentOSサーバーのルートSSHポートをチェックすることでした。構成ファイルで行ったようにサービスが開始されませんでした。そのため、調査後にデフォルトポートを変更できるように selinux でいくつかの変更を行う必要があることがわかりました。

したがって、私がしなければならないのは、次のコマンドを実行することだけです。

semanage port -a -t ssh_port_t -p tcp <port>

ただし、これを行うと、次のエラーが発生します。

Invalid protocol Bad portcon declaration at /etc/selinux/targeted/tmp/modules/100/base/cil:669 OSError: Error

コマンドを実行しようとすると

semanage port -l

次のエラーが発生します。

`libsepol.ipproto2sepol: invalid protocol 132 found in policy (No such file or directory).
libsepol.port_to_record: could not convert port range 1 - 511 (???) to record (No such file or directory).
libsepol.sepol_port_iterate: could not iterate over ports (No such file or directory).
libsemanage.dbase_policydb_list: list handler could not extract record (No such file or directory).
libsemanage.dbase_policydb_list: could not list records (No such file or directory).
OSError: No such file or directory`

動作させるために必要なすべてのパッケージをダウンロードしました。

ベストアンサー1

以下のパッケージをインストールしてコマンドを実行します。

yum install policycoreutils-python-utils

おすすめ記事