以下是CentOS系统下GitLab的安全设置指南:
firewalld
仅允许HTTP(80端口)、HTTPS(443端口)和SSH(22端口)访问,命令为sudo firewall-cmd --permanent --add-service={http,https,ssh}
,然后sudo firewall-cmd --reload
。/etc/gitlab/gitlab.rb
文件,配置external_url
为HTTPS地址,并设置证书路径等相关参数,最后运行sudo gitlab-ctl reconfigure
和sudo gitlab-ctl restart
。/etc/pam.d/system-auth
文件设置密码复杂度规则,要求密码包含多种字符且长度足够。.gitignore
文件忽略敏感信息,检查提交内容防止敏感信息上传。/var/log/gitlab/
下的日志文件,如gitlab_access.log
和gitlab_error.log
。