
私はGitlabのガイドに従い、承認されたSSHキーをすばやく照会できます。このガイドでは、AuthorizedKeysCommandを使用するように指示します。認証コマンドがローカルhttpsサーバーを呼び出しています。このコマンドチェーンはSELinuxポリシー違反を引き起こします。
私が受け取るエラーは次のとおりです。
type=AVC msg=audit(1559126095.648:64173782): avc: denied { name_connect } for pid=13839 comm="gitlab-shell-au" dest=8081 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:transproxy_port_t:s0 tclass=tcp_socket permissive=0
記憶が正しい場合は、カスタムSELinuxポリシーが必要です。しかし、私が見つけたすべてのガイドは過度に複雑でした。この例外を許可するポリシーファイルを作成するのは簡単な作業です。
sshd_tプロセスがtransproxy_port_tを使用できるようにするポリシー(.te)ファイルがどのように見えるかをご存知ですか?
編集する。 Gitlabは、標準ポート(8080)でunicornを実行するときに必要なポリシーを設定します。
答え1
次のことができます。
# generate the policy .te file
echo "type=AVC msg=audit(1559126095.648:64173782): avc: denied { name_connect } for pid=13839 comm="gitlab-shell-au" dest=8081 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:transproxy_port_t:s0 tclass=tcp_socket permissive=0" | audit2allow -m gitlabfix1 > gitlabfix1.te
# create a module from the .te file
checkmodule -M -m -o gitlabfix1.mod gitlabfix1.te
# package it
semodule_package -o gitlabfix1.pp -m gitlabfix1.mod
# install it
semodule -i gitlabfix1.pp
より短い方法がありますが、中間の.teファイルを生成しません。 .teファイルはアーカイブと理解の目的に便利です:-).
より短い方法は次のとおりです。
# generate the policy module package in one go
echo "type=AVC msg=audit(1559126095.648:64173782): avc: denied { name_connect } for pid=13839 comm="gitlab-shell-au" dest=8081 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:transproxy_port_t:s0 tclass=tcp_socket permissive=0" | audit2allow -M gitlabfix2
# and load it
semodule -i gitlabfix2.pp
トレーニング目的で.teファイルは次のとおりです。
module gitlabfix1 1.0;
require {
type transproxy_port_t;
type sshd_t;
class tcp_socket name_connect;
}
#============= sshd_t ==============
allow sshd_t transproxy_port_t:tcp_socket name_connect;