用加密方式連線溝通 GitLab,也就是 https://

自建憑證

mkdir -p /etc/gitlab/ssl
chmod 700 /etc/gitlab/ssl
openssl genrsa -out "/etc/gitlab/ssl/git.ssorc.tw.key" 2048
openssl req -new -key "/etc/gitlab/ssl/git.ssorc.tw.key" -out "git.ssorc.tw.csr" -subj '/C=TW/ST=Taiwan/L=Taipei/CN=git.ssorc.tw/emailAddress=root@git.ssorc.tw'
openssl x509 -req -days 3650 -in "git.ssorc.tw.csr" -signkey "/etc/gitlab/ssl/git.ssorc.tw.key" -out "/etc/gitlab/ssl/git.ssorc.tw.crt"
rm -f "git.ssorc.tw.csr"

編輯 /etc/gitlab/gitlab.rb

external_url 'https://git.ssorc.tw:8843'
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 8888
nginx['ssl_certificate'] = "/etc/gitlab/ssl/git.ssorc.tw.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/git.ssorc.tw.key"

reload

gitlab-ctl reconfigure

瀏覽 http://git.ssorc.tw:8888 時就會導到 https://git.ssorc.tw:8843

Related posts 相關文章
用 DNSSEC 是為了安全,但如果憑證過期了怎麼辦
More...
使用 dehydrated 安裝 Let’s Encrypt SSL 憑證
More...
使用 certbot 安裝 Let’s Encrypt SSL 憑證
More...
最近要小心 GitHub 上的 POC 庫,可能是惡意程式
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。