@@ -351,6 +351,10 @@ gitlab_configure_gitaly() {
351
351
gitlab_configure_monitoring () {
352
352
echo " Configuring gitlab::monitoring..."
353
353
354
+ if [ " ${GITLAB_MONITORING_IP_WHITELIST} " == " " ]; then
355
+ exec_as_git sed -i " /{{GITLAB_MONITORING_IP_WHITELIST}}/d" ${GITLAB_CONFIG}
356
+ fi
357
+
354
358
update_template ${GITLAB_CONFIG} \
355
359
GITLAB_MONITORING_UNICORN_SAMPLER_INTERVAL \
356
360
GITLAB_MONITORING_IP_WHITELIST \
@@ -705,28 +709,30 @@ gitlab_configure_oauth_saml() {
705
709
fi
706
710
}
707
711
708
- # gitlab_configure_oauth2_generic() {
709
- # if [[ -n ${OAUTH2_GENERIC_APP_ID} && \
710
- # -n ${OAUTH2_GENERIC_APP_SECRET} ]]; then
711
- # echo "Configuring gitlab::oauth::generic..."
712
- # OAUTH_ENABLED=${OAUTH_ENABLED:-true}
713
- # update_template ${GITLAB_CONFIG} \
714
- # OAUTH2_GENERIC_APP_ID \
715
- # OAUTH2_GENERIC_APP_SECRET \
716
- # OAUTH2_GENERIC_CLIENT_SITE \
717
- # OAUTH2_GENERIC_CLIENT_USER_INFO_URL \
718
- # OAUTH2_GENERIC_CLIENT_AUTHORIZE_URL \
719
- # OAUTH2_GENERIC_CLIENT_TOKEN_URL \
720
- # OAUTH2_GENERIC_CLIENT_END_SESSION_ENDPOINT \
721
- # OAUTH2_GENERIC_ID_PATH \
722
- # OAUTH2_GENERIC_USER_UID \
723
- # OAUTH2_GENERIC_USER_NAME \
724
- # OAUTH2_GENERIC_USER_EMAIL \
725
- # OAUTH2_GENERIC_NAME
726
- # else
727
- # exec_as_git sed -i "/name: 'oauth2_generic'/,/{{OAUTH2_GENERIC_NAME}}/d" ${GITLAB_CONFIG}
728
- # fi
729
- # }
712
+ gitlab_configure_oauth2_generic () {
713
+ if [[ -n ${OAUTH2_GENERIC_APP_ID} && \
714
+ -n ${OAUTH2_GENERIC_APP_SECRET} ]]; then
715
+ echo " Configuring gitlab::oauth::generic..."
716
+ OAUTH_ENABLED=${OAUTH_ENABLED:- true}
717
+ update_template ${GITLAB_CONFIG} \
718
+ OAUTH2_GENERIC_APP_ID \
719
+ OAUTH2_GENERIC_APP_SECRET \
720
+ OAUTH2_GENERIC_CLIENT_SITE \
721
+ OAUTH2_GENERIC_CLIENT_USER_INFO_URL \
722
+ OAUTH2_GENERIC_CLIENT_AUTHORIZE_URL \
723
+ OAUTH2_GENERIC_CLIENT_TOKEN_URL \
724
+ OAUTH2_GENERIC_CLIENT_END_SESSION_ENDPOINT \
725
+ OAUTH2_GENERIC_ID_PATH \
726
+ OAUTH2_GENERIC_USER_UID \
727
+ OAUTH2_GENERIC_USER_NAME \
728
+ OAUTH2_GENERIC_USER_EMAIL \
729
+ OAUTH2_GENERIC_AUTHORIZE_PARAMS_SCOPE \
730
+ OAUTH2_GENERIC_LABEL \
731
+ OAUTH2_GENERIC_NAME
732
+ else
733
+ exec_as_git sed -i " /name: 'oauth2_generic'/,/{{OAUTH2_GENERIC_NAME}}/d" ${GITLAB_CONFIG}
734
+ fi
735
+ }
730
736
731
737
gitlab_configure_oauth_crowd () {
732
738
if [[ -n ${OAUTH_CROWD_SERVER_URL} && \
@@ -778,7 +784,7 @@ gitlab_configure_oauth_azure() {
778
784
gitlab_configure_oauth2_generic_ustc () {
779
785
if [[ -n ${OAUTH2_GENERIC_USTC_APP_ID} && \
780
786
-n ${OAUTH2_GENERIC_USTC_APP_SECRET} ]]; then
781
- echo " Configuring gitlab::oauth::generic_ustc ..."
787
+ echo " Configuring gitlab::oauth::generic ..."
782
788
OAUTH_ENABLED=${OAUTH_ENABLED:- true}
783
789
update_template ${GITLAB_CONFIG} \
784
790
OAUTH2_GENERIC_USTC_APP_ID \
@@ -830,11 +836,11 @@ gitlab_configure_oauth() {
830
836
gitlab_configure_oauth_gitlab
831
837
gitlab_configure_oauth_bitbucket
832
838
gitlab_configure_oauth_saml
833
- # gitlab_configure_oauth2_generic
839
+ gitlab_configure_oauth2_generic
834
840
gitlab_configure_oauth_crowd
835
841
gitlab_configure_oauth_auth0
836
842
gitlab_configure_oauth_azure
837
- gitlab_configure_oauth2_generic_ustc
843
+ gitlab_configure_oauth_azure_ad_v2
838
844
gitlab_configure_oauth_oidc
839
845
840
846
OAUTH_ENABLED=${OAUTH_ENABLED:- false}
@@ -845,7 +851,8 @@ gitlab_configure_oauth() {
845
851
OAUTH_AUTO_LINK_LDAP_USER \
846
852
OAUTH_AUTO_LINK_SAML_USER \
847
853
OAUTH_AUTO_LINK_USER \
848
- OAUTH_EXTERNAL_PROVIDERS
854
+ OAUTH_EXTERNAL_PROVIDERS \
855
+ OAUTH_ALLOW_BYPASS_TWO_FACTOR
849
856
850
857
case ${OAUTH_AUTO_SIGN_IN_WITH_PROVIDER} in
851
858
cas3|google_oauth2|facebook|twitter|github|gitlab|bitbucket|saml|crowd|azure_oauth2|azure_activedirectory_v2|oauth2_generic|$OAUTH2_GENERIC_NAME |oidc)
@@ -1097,6 +1104,24 @@ gitlab_configure_analytics() {
1097
1104
1098
1105
gitlab_configure_rack_attack () {
1099
1106
echo " Configuring gitlab::rack_attack..."
1107
+
1108
+ # validity check : RACK_ATTACK_WHITELIST should be an array of valid IP Address string
1109
+ echo " Validating RACK_ATTACK_WHITELIST..."
1110
+ /usr/bin/env ruby << SCRIPT
1111
+ require 'ipaddr'
1112
+ ${RACK_ATTACK_WHITELIST} .each do |host|
1113
+ begin
1114
+ printf(" input=%s, to_range=%s\n", host, IPAddr.new(host).to_range)
1115
+ rescue IPAddr::InvalidAddressError => e
1116
+ p e
1117
+ exit 1
1118
+ rescue => e
1119
+ put "Unexpected error", e
1120
+ exit 1
1121
+ end
1122
+ end
1123
+ SCRIPT
1124
+
1100
1125
update_template ${GITLAB_CONFIG} \
1101
1126
RACK_ATTACK_ENABLED \
1102
1127
RACK_ATTACK_WHITELIST \
@@ -1672,7 +1697,12 @@ initialize_datadir() {
1672
1697
chmod u+rwX ${GITLAB_SHARED_DIR} /ci_secure_files
1673
1698
chown ${GITLAB_USER} : ${GITLAB_SHARED_DIR} /ci_secure_files
1674
1699
1675
- # create attifacts dir
1700
+ # create external-diffs dir
1701
+ mkdir -p ${GITLAB_SHARED_DIR} /external-diffs
1702
+ chmod u+rwX ${GITLAB_SHARED_DIR} /external-diffs
1703
+ chown ${GITLAB_USER} : ${GITLAB_SHARED_DIR} /external-diffs
1704
+
1705
+ # create artifacts dir
1676
1706
mkdir -p ${GITLAB_ARTIFACTS_DIR}
1677
1707
chmod u+rwX ${GITLAB_ARTIFACTS_DIR}
1678
1708
chown ${GITLAB_USER} : ${GITLAB_ARTIFACTS_DIR}
@@ -1832,13 +1862,13 @@ generate_healthcheck_script() {
1832
1862
# configure healthcheck script
1833
1863
# # https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
1834
1864
local HEALTHCHECK_PROTOCOL=" http"
1835
- if [[ " ${GITLAB_HTTPS} " == true ]]; then
1865
+ if [[ " ${GITLAB_HTTPS} " == true && " ${SSL_SELF_SIGNED} " == false ]]; then
1836
1866
HEALTHCHECK_PROTOCOL=" ${HEALTHCHECK_PROTOCOL} s"
1837
1867
fi
1838
1868
cat > /usr/local/sbin/healthcheck << EOF
1839
1869
#!/bin/bash
1840
- url=${HEALTHCHECK_PROTOCOL} ://localhost ${GITLAB_RELATIVE_URL_ROOT} /-/liveness
1841
- options=( '--insecure' '--location' '-- silent' )
1870
+ url=${HEALTHCHECK_PROTOCOL} ://127.0.0.1 ${GITLAB_RELATIVE_URL_ROOT} /-/liveness
1871
+ options=( '--insecure' '--silent' )
1842
1872
curl "\$ {options[@]}" \$ url
1843
1873
[[ "\$ (curl \$ {options[@]} -o /dev/null -I -w '%{http_code}' \$ url)" == "200" ]]
1844
1874
EOF
@@ -2014,6 +2044,7 @@ configure_gitlab() {
2014
2044
rm -rf ${GITLAB_INSTALL_DIR} /tmp/sockets/gitlab.socket
2015
2045
}
2016
2046
2047
+ # feature flags are recorded to database (schema "application_settings") so requires DB is (at least) initialized
2017
2048
gitlab_configure_feature_flags () {
2018
2049
echo " Configuring gitlab::feature_flags..."
2019
2050
@@ -2228,10 +2259,9 @@ migrate_database() {
2228
2259
mkdir -p ${GITLAB_HOME} /gitlab/node_modules
2229
2260
chown -R ${GITLAB_USER} : ${GITLAB_HOME} /gitlab/node_modules
2230
2261
fi
2231
- echo " Prepare recomplie assets... Installing missing node_modules for assets"
2262
+ echo " Prepare recompile assets... Installing missing node_modules for assets"
2232
2263
chown -R ${GITLAB_USER} : ${GITLAB_HOME} /gitlab/node_modules
2233
2264
exec_as_git yarn install --production --pure-lockfile
2234
- exec_as_git yarn add ajv@^4.0.0
2235
2265
echo " Recompiling assets (relative_url in use), this could take a while..."
2236
2266
exec_as_git bundle exec rake gitlab:assets:compile NODE_OPTIONS=" --max-old-space-size=4096" > /dev/null 2>&1
2237
2267
fi
0 commit comments