You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "maskit (via GitHub)" <gi...@apache.org> on 2025/07/13 05:04:51 UTC
[PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
maskit opened a new pull request, #12359:
URL: https://github.com/apache/trafficserver/pull/12359
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#discussion_r2350280049
##########
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnVerifiedAddr.test.py:
##########
@@ -0,0 +1,70 @@
+'''
+'''
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test TS API to get and set a verified address
+'''
+
+Test.ContinueOnFail = True
+
+# ----
+# Setup Origin Server
+# ----
+httpbin = Test.MakeHttpBinServer("httpbin")
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+# add ssl materials like key, certificates for the server
+ts.addDefaultSSLFiles()
Review Comment:
Do we use TLS in this test? If not, we can simplify by removing the https config.
##########
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnVerifiedAddr.test.py:
##########
@@ -0,0 +1,70 @@
+'''
+'''
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test TS API to get and set a verified address
+'''
+
+Test.ContinueOnFail = True
+
+# ----
+# Setup Origin Server
+# ----
+httpbin = Test.MakeHttpBinServer("httpbin")
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+# add ssl materials like key, certificates for the server
+ts.addDefaultSSLFiles()
+
+ts.Disk.remap_config.AddLines([f'map /httpbin/ http://127.0.0.1:{httpbin.Variables.Port}/'])
+
+ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key')
+
+Test.PrepareTestPlugin(
+ os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'tsapi', '.libs', 'test_TSHttpTxnVerifiedAddr.so'), ts)
+
+ts.Setup.CopyAs('hrw_verified_addr.conf', Test.RunDirectory)
+ts.Disk.plugin_config.AddLine(f'header_rewrite.so --inbound-ip-source=PLUGIN {Test.RunDirectory}/hrw_verified_addr.conf')
+
+ts.Disk.records_config.update(
+ {
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'http|test_TSHttpTxnVerifiedAddr',
+ 'proxy.config.ssl.server.cert.path': f'{ts.Variables.SSLDir}',
+ 'proxy.config.ssl.server.private_key.path': f'{ts.Variables.SSLDir}'
+ })
+
+# ----
+# Test Cases
+# ----
+
+tr = Test.AddTestRun()
+tr.MakeCurlCommand(f'-v http://127.0.0.1:{ts.Variables.port}/httpbin/get', ts=ts)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
Review Comment:
I think that the httpbin.test.ext should take care of this ready already.
##########
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnVerifiedAddr.test.py:
##########
@@ -0,0 +1,70 @@
+'''
+'''
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test TS API to get and set a verified address
+'''
+
+Test.ContinueOnFail = True
+
+# ----
+# Setup Origin Server
+# ----
+httpbin = Test.MakeHttpBinServer("httpbin")
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+# add ssl materials like key, certificates for the server
+ts.addDefaultSSLFiles()
+
+ts.Disk.remap_config.AddLines([f'map /httpbin/ http://127.0.0.1:{httpbin.Variables.Port}/'])
+
+ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key')
+
+Test.PrepareTestPlugin(
+ os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'tsapi', '.libs', 'test_TSHttpTxnVerifiedAddr.so'), ts)
+
+ts.Setup.CopyAs('hrw_verified_addr.conf', Test.RunDirectory)
+ts.Disk.plugin_config.AddLine(f'header_rewrite.so --inbound-ip-source=PLUGIN {Test.RunDirectory}/hrw_verified_addr.conf')
+
+ts.Disk.records_config.update(
+ {
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'http|test_TSHttpTxnVerifiedAddr',
+ 'proxy.config.ssl.server.cert.path': f'{ts.Variables.SSLDir}',
+ 'proxy.config.ssl.server.private_key.path': f'{ts.Variables.SSLDir}'
+ })
+
+# ----
+# Test Cases
+# ----
+
+tr = Test.AddTestRun()
Review Comment:
AddTestRun descriptions can be helpful.
##########
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnVerifiedAddr.test.py:
##########
@@ -0,0 +1,70 @@
+'''
+'''
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test TS API to get and set a verified address
+'''
+
+Test.ContinueOnFail = True
+
+# ----
+# Setup Origin Server
+# ----
+httpbin = Test.MakeHttpBinServer("httpbin")
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+# add ssl materials like key, certificates for the server
+ts.addDefaultSSLFiles()
+
+ts.Disk.remap_config.AddLines([f'map /httpbin/ http://127.0.0.1:{httpbin.Variables.Port}/'])
Review Comment:
AddLine since only one line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#discussion_r2350336060
##########
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnVerifiedAddr.test.py:
##########
@@ -0,0 +1,70 @@
+'''
+'''
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+Test.Summary = '''
+Test TS API to get and set a verified address
+'''
+
+Test.ContinueOnFail = True
+
+# ----
+# Setup Origin Server
+# ----
+httpbin = Test.MakeHttpBinServer("httpbin")
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", enable_tls=True)
+
+# add ssl materials like key, certificates for the server
+ts.addDefaultSSLFiles()
+
+ts.Disk.remap_config.AddLines([f'map /httpbin/ http://127.0.0.1:{httpbin.Variables.Port}/'])
+
+ts.Disk.ssl_multicert_config.AddLine('dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key')
+
+Test.PrepareTestPlugin(
+ os.path.join(Test.Variables.AtsBuildGoldTestsDir, 'pluginTest', 'tsapi', '.libs', 'test_TSHttpTxnVerifiedAddr.so'), ts)
+
+ts.Setup.CopyAs('hrw_verified_addr.conf', Test.RunDirectory)
+ts.Disk.plugin_config.AddLine(f'header_rewrite.so --inbound-ip-source=PLUGIN {Test.RunDirectory}/hrw_verified_addr.conf')
+
+ts.Disk.records_config.update(
+ {
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'http|test_TSHttpTxnVerifiedAddr',
+ 'proxy.config.ssl.server.cert.path': f'{ts.Variables.SSLDir}',
+ 'proxy.config.ssl.server.private_key.path': f'{ts.Variables.SSLDir}'
+ })
+
+# ----
+# Test Cases
+# ----
+
+tr = Test.AddTestRun()
+tr.MakeCurlCommand(f'-v http://127.0.0.1:{ts.Variables.port}/httpbin/get', ts=ts)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
Review Comment:
Looks like you're right, but I see a couple of tests that do the same. I'll update all those tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#issuecomment-3091230251
> Maybe add an autest for it? It would be good to get coverage on at least the simple case just to verify the setter/getter api is working correctly. We could have a test plugin that simply reads an IP from something like a client-ip request header, sets it, gets the value, and adds a client-ip response header that then can be verified by the autest.
Yes, I will add it. I'm going to write a test for the experimental plugin (the simple mode), and use header_rewrite as well to test the getter API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#discussion_r2216910386
##########
doc/admin-guide/plugins/realip.en.rst:
##########
@@ -0,0 +1,86 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+ .. include:: ../../common.defs
+
+.. _admin-plugins-realip:
+
+Real IP Plugin
+*******************
+
+Description
+===========
+The `realip` plugin reads an IP address from a specified data source such as HTTP header field, and make it available for ATS and
+its plugins as the verified client address.
+
+To use the verified client IP address for ACL, :ts:cv:`proxy.config.acl.subjects` needs to be set to `PLUGIN`.
+Similary, if you want to use the IP address on header_rewrite plugin, its `INBOUND_IP_SOURCE` needs to be set to `PLUGIN`.
+
+
+Configuration
+=============
+
+To enable the `realip` plugin, insert the following line in :file:`plugin.config`:
Review Comment:
I think you'll need two `::` at the end to make this a code block.
##########
doc/admin-guide/plugins/realip.en.rst:
##########
@@ -0,0 +1,86 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+ .. include:: ../../common.defs
+
+.. _admin-plugins-realip:
+
+Real IP Plugin
+*******************
+
+Description
+===========
+The `realip` plugin reads an IP address from a specified data source such as HTTP header field, and make it available for ATS and
+its plugins as the verified client address.
+
+To use the verified client IP address for ACL, :ts:cv:`proxy.config.acl.subjects` needs to be set to `PLUGIN`.
+Similary, if you want to use the IP address on header_rewrite plugin, its `INBOUND_IP_SOURCE` needs to be set to `PLUGIN`.
+
+
+Configuration
+=============
+
+To enable the `realip` plugin, insert the following line in :file:`plugin.config`:
+
+ realip.so <config.yaml>
+
+The plugin supports 2 mode:
Review Comment:
`mode` -> `modes`
##########
doc/admin-guide/plugins/realip.en.rst:
##########
@@ -0,0 +1,86 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+ .. include:: ../../common.defs
+
+.. _admin-plugins-realip:
+
+Real IP Plugin
+*******************
+
+Description
+===========
+The `realip` plugin reads an IP address from a specified data source such as HTTP header field, and make it available for ATS and
+its plugins as the verified client address.
+
+To use the verified client IP address for ACL, :ts:cv:`proxy.config.acl.subjects` needs to be set to `PLUGIN`.
+Similary, if you want to use the IP address on header_rewrite plugin, its `INBOUND_IP_SOURCE` needs to be set to `PLUGIN`.
Review Comment:
Let's link `header_rewrite` to the header rewrite plugin docs.
##########
doc/developer-guide/api/functions/TSHttpTxnVerifiedAddrSet.en.rst:
##########
@@ -0,0 +1,64 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright
+ ownership. The ASF licenses this file to you under the Apache
+ License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of
+ the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+.. include:: ../../../common.defs
+
+.. default-domain:: cpp
+
+TSHttpTxnVerifiedAddrSet
+************************
+
+Sets a client IP address verified by a plugin.
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+
+.. function:: TSReturnCode TSHttpTxnVerifiedAddrSet(TSHttpTxn txnp, const struct sockaddr *addr)
+
+Description
+===========
+
+This function enables plugins to provide a reliable client IP address for |TS| and other plugins.
+This is useful if there is a proxy in front of |TS| and it forwards client's IP address by HTTP header field, PROXY protocol, etc.
+Plugins that call this function are expected to check the validity of the IP address.
+
+The provided address will be used for remap ACL if :ts:cv:`proxy.config.acl.subjects` is set to `PLUGIN`.
+Plugins can get the provided address by calling the getter function bewlow if those need client's real IP address.
Review Comment:
`bewlow`
##########
doc/developer-guide/api/functions/TSHttpTxnVerifiedAddrSet.en.rst:
##########
@@ -0,0 +1,64 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright
+ ownership. The ASF licenses this file to you under the Apache
+ License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of
+ the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+.. include:: ../../../common.defs
+
+.. default-domain:: cpp
+
+TSHttpTxnVerifiedAddrSet
+************************
+
+Sets a client IP address verified by a plugin.
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+
+.. function:: TSReturnCode TSHttpTxnVerifiedAddrSet(TSHttpTxn txnp, const struct sockaddr *addr)
+
+Description
+===========
+
+This function enables plugins to provide a reliable client IP address for |TS| and other plugins.
+This is useful if there is a proxy in front of |TS| and it forwards client's IP address by HTTP header field, PROXY protocol, etc.
+Plugins that call this function are expected to check the validity of the IP address.
+
+The provided address will be used for remap ACL if :ts:cv:`proxy.config.acl.subjects` is set to `PLUGIN`.
+Plugins can get the provided address by calling the getter function bewlow if those need client's real IP address.
+
+
+TSHttpTxnVerifiedAddrGet
+************************
+
+Gets the client IP address verified by a plugin.
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+
+.. function:: TSReturnCode TSHttpTxnVerifiedAddrGet(TSHttpTxn txnp, const struct sockaddr **addr)
+
+Description
+===========
+
+This is the getter version for the above setter. This returns 1 if a verified address is available.
+Please note that a port number is not always available even if the function returns 1.
Review Comment:
It's probably good to explicitly say that the memory for the `addr` output parameter is managed by ATS core and should not be freed by the caller.
##########
doc/admin-guide/plugins/realip.en.rst:
##########
@@ -0,0 +1,86 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+ .. include:: ../../common.defs
+
+.. _admin-plugins-realip:
+
+Real IP Plugin
+*******************
+
+Description
+===========
+The `realip` plugin reads an IP address from a specified data source such as HTTP header field, and make it available for ATS and
Review Comment:
`make it` -> `makes it`
##########
doc/developer-guide/api/functions/TSHttpTxnVerifiedAddrSet.en.rst:
##########
@@ -0,0 +1,64 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright
+ ownership. The ASF licenses this file to you under the Apache
+ License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of
+ the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+.. include:: ../../../common.defs
+
+.. default-domain:: cpp
+
+TSHttpTxnVerifiedAddrSet
+************************
+
+Sets a client IP address verified by a plugin.
+
+Synopsis
+========
+
+.. code-block:: cpp
+
+ #include <ts/ts.h>
+
+.. function:: TSReturnCode TSHttpTxnVerifiedAddrSet(TSHttpTxn txnp, const struct sockaddr *addr)
+
+Description
+===========
+
+This function enables plugins to provide a reliable client IP address for |TS| and other plugins.
+This is useful if there is a proxy in front of |TS| and it forwards client's IP address by HTTP header field, PROXY protocol, etc.
+Plugins that call this function are expected to check the validity of the IP address.
+
+The provided address will be used for remap ACL if :ts:cv:`proxy.config.acl.subjects` is set to `PLUGIN`.
Review Comment:
Probably good to explicitly say that ATS core makes and maintains its own copy of the memory from `addr`.
##########
doc/admin-guide/plugins/realip.en.rst:
##########
@@ -0,0 +1,86 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+
+ .. include:: ../../common.defs
+
+.. _admin-plugins-realip:
+
+Real IP Plugin
+*******************
+
+Description
+===========
+The `realip` plugin reads an IP address from a specified data source such as HTTP header field, and make it available for ATS and
+its plugins as the verified client address.
+
+To use the verified client IP address for ACL, :ts:cv:`proxy.config.acl.subjects` needs to be set to `PLUGIN`.
+Similary, if you want to use the IP address on header_rewrite plugin, its `INBOUND_IP_SOURCE` needs to be set to `PLUGIN`.
+
+
+Configuration
+=============
+
+To enable the `realip` plugin, insert the following line in :file:`plugin.config`:
+
+ realip.so <config.yaml>
+
+The plugin supports 2 mode:
+
+simple
+------
+
+The plugin reads an IP address from a specified HTTP header field. These settings bewlow are available for this mode:
Review Comment:
`bewlow`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#issuecomment-3281569446
I updated the documentation, and added tests. Please take another look.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359#issuecomment-3294287378
Thanks for the feedback. I'll make another PR to update the test because this PR is blocking #12501.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TS API: Add TSHttpTxnVerifiedAddrSet/Get and real-ip plugin [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit merged PR #12359:
URL: https://github.com/apache/trafficserver/pull/12359
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org