Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gateway] Request not logged when X-Forwarded-For header contains IPv4-mapped IPv6 address #2186

Closed
achaussier opened this issue May 1, 2019 · 0 comments

Comments

@achaussier
Copy link

commented May 1, 2019

When X-Forwarded-For header contains IPv4-mapped IPv6 address (ex: ::ffff:1.2.3.4), we have an error on elastic search and request is no logged.

[2019-05-01T16:25:44,958][DEBUG][o.e.a.b.TransportBulkAction] [qjtC9Vt] failed to execute pipeline [gravitee_pipeline] for document [gravitee-request-2019.05.01/request/6c2edbf5-b114-4bc5-aedb-f5b1143bc5a6]
org.elasticsearch.ElasticsearchException: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: '' is not an IP string literal.
	at org.elasticsearch.ingest.CompoundProcessor.newCompoundProcessorException(CompoundProcessor.java:188) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.CompoundProcessor.execute(CompoundProcessor.java:134) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.Pipeline.execute(Pipeline.java:97) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.IngestService.innerExecute(IngestService.java:479) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.IngestService.access$100(IngestService.java:68) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.IngestService$4.doRun(IngestService.java:408) [elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) [elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.5.4.jar:6.5.4]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: '' is not an IP string literal.
	... 11 more
Caused by: java.lang.IllegalArgumentException: '' is not an IP string literal.
	at org.elasticsearch.common.network.InetAddresses.forString(InetAddresses.java:335) ~[elasticsearch-6.5.4.jar:6.5.4]
	at org.elasticsearch.ingest.geoip.GeoIpProcessor.execute(GeoIpProcessor.java:98) ~[?:?]
	at org.elasticsearch.ingest.CompoundProcessor.execute(CompoundProcessor.java:124) ~[elasticsearch-6.5.4.jar:6.5.4]
	... 9 more

Expected Behavior

Request should be logged properly with IPv4-mapped IPv6 address in X-Forwarded-For header.

Current Behavior

Request is not logged.

Possible Solution

In the error, we can se remote-address is an empty string, so perhaps this kind of IP notation is not properly parsed

Steps to Reproduce (for bugs)

  1. Define any API on gravitee
  2. Add an X-Forwarded-For header with an IPv4-mapped IPv6 address
  3. Check elasticsearch logs

Context

[External client]  ---> [HAProxy] ---> [Nginx (Reverse proxy)] ---> [Gateway]

Your Environment

  • Version used: 1.25.0
  • HAProxy: 1.8.13
  • Nginx: 1.13.12

brasseld added a commit to gravitee-io/gravitee-gateway that referenced this issue May 2, 2019

@brasseld brasseld self-assigned this May 2, 2019

@brasseld brasseld added this to the 1.25.1 milestone May 2, 2019

NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue May 3, 2019

NicolasGeraud added a commit to gravitee-io/gravitee-gateway that referenced this issue May 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.