gitlab ์ ssh ๋ก ์ฐ๊ฒฐ์ permission denied ์๋ฌ ๋ฐ์
ย
์์ธ
git ๊ณ์ ์ ํ ๋๋ ํฐ๋ฆฌ์ .ssh ํด๋๊ฐ ์๋ชป๋ SELinux ์ปจํ ์คํธ(context )๋ฅผ ๊ฐ๊ณ ์์ ๊ฒฝ์ฐ์ ๋ง์ด ๋ฐ์ํ๋ค
ย
ํ์ธ
.ssh ์ SELinux ๋ ์ด๋ธ์ ํ์ธํ๋ค.
ls -ldZ ~/.ssh/ ย drwx------. git git unconfined_u:object_r:ssh_home_t:s0 /home/git//.ssh/
์์ ๊ฐ์ด ssh_home_tย context ย ์ฌ์ผ ํ๋ฉฐ ๋ค๋ฅธ ์ปจํ ์คํธ์ผ ๊ฒฝ์ฐ SELinux ๊ฐ ssh ๋ฐ๋ชฌ์ด ์ ํด๋๋ฅผ ์ฝ๋ ๊ฒ์ ์ฐจ๋จํ๋ฏ๋ก ์ธ์ฆ๋ ๊ณต๊ฐํค ํ์ผ(authorized_keys)์ ์ฝ์ง ๋ชปํด์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค.
ย
SELinux ์๋ฌ ๋ก๊ทธ ํ์ธ
audit2why < /var/log/audit/audit.log ย type=AVC msg=audit(1412569067.614:2916): avc: denied { read } for pid=2781 comm="sshd" name="authorized_keys" dev=dm-2 ino=131169 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:initrc_tmp_t:s0 tclass=file Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.
ย
์กฐ์น
๋ง๋ SELinux ๋ ์ด๋ธ์ .ssh ํด๋์ ๋ถ์ฌํ๋ค.
restorecon -R /home/git/.ssh