Repository navigation
feat(roles/gitlab_ce): make the nginx real_ip settings configurable - #463
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Behind a reverse proxy, GitLab shows and logs the address of the proxy as the client IP, for example under "Current sign-in IP".
gitlab_ce__rb_nginx_real_ip_trusted_addresses. When set, the template rendersnginx['real_ip_trusted_addresses'],nginx['real_ip_header']andnginx['real_ip_recursive'].gitlab_ce__rb_nginx_real_ip_headerdefaults toX-Forwarded-For, which Apachemod_proxyand HAProxy withoption forwardforsend. Without it, nginx falls back toX-Real-IPand the setting silently has no effect.gitlab_ce__rb_nginx_real_ip_recursivedefaults totrue. It is required for chained proxies and makes no difference with a single one.gitlab_rails['trusted_proxies']: omnibus copiesreal_ip_trusted_addressesinto it when it is unset (parse_gitlab_trusted_proxiesingitlab_rails.rb).Test
No Molecule scenario exists for
gitlab_ce. Tested by hand in arockylinux:9-ubi-initcontainer with GitLab CE 19.5.0, rendered template with onlygitlab_ce__rb_nginx_real_ip_trusted_addresses: ['127.0.0.0/8'],127.0.0.1acting as the proxy:X-Forwarded-Formeta.remote_ip)203.0.113.7203.0.113.7203.0.113.7203.0.113.7, 127.0.0.5203.0.113.7203.0.113.7198.51.100.66, 203.0.113.7203.0.113.7203.0.113.7127.0.0.1127.0.0.1A sign-in as root stored
203.0.113.7ascurrent_sign_in_ip. Without the variable, Rails sees127.0.0.1.