mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
add integration test for https IP address route (#4477)
add integration test for https IP address route (#4476) Update the integration test libsonnet templates to assign a fixed IP address to the trusted-httpdetails service. This requires also assigning a fixed IP subnet to the docker network. Configure a route with a 'to' URL using https and this fixed IP address. Add a corresponding certificate with the IP address. Finally, add a test case that makes a request to this route.
This commit is contained in:
parent
b4b80f26f7
commit
0d1744a31a
11 changed files with 217 additions and 115 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -411,3 +411,20 @@ func rawJWTPayload(t *testing.T, jwt string) map[string]interface{} {
|
|||
require.NoError(t, err, "JWT payload could not be deserialized")
|
||||
return decoded
|
||||
}
|
||||
|
||||
func TestUpstreamViaIPAddress(t *testing.T) {
|
||||
// Verify that we can make a successful request to a route with a 'to' URL
|
||||
// that uses https with an IP address.
|
||||
client := getClient(t)
|
||||
res, err := client.Get("https://httpdetails-ip-address.localhost.pomerium.io/")
|
||||
require.NoError(t, err, "unexpected http error")
|
||||
defer res.Body.Close()
|
||||
|
||||
var result struct {
|
||||
Headers map[string]string `json:"headers"`
|
||||
Protocol string `json:"protocol"`
|
||||
}
|
||||
err = json.NewDecoder(res.Body).Decode(&result)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "https", result.Protocol)
|
||||
}
|
||||
|
|
|
@ -4,8 +4,9 @@ local Variations() =
|
|||
[
|
||||
{
|
||||
name: 'trusted',
|
||||
cert: importstr '../files/trusted.pem',
|
||||
key: importstr '../files/trusted-key.pem',
|
||||
cert: importstr '../files/trusted-sans.pem',
|
||||
key: importstr '../files/trusted-sans-key.pem',
|
||||
ipv4Address: '172.20.0.50',
|
||||
},
|
||||
{
|
||||
name: 'trusted-1',
|
||||
|
@ -60,6 +61,11 @@ function() {
|
|||
utils.ComposeService(variation.name + '-' + suffix, {
|
||||
image: image,
|
||||
command: Command(variation),
|
||||
[if std.get(variation, 'ipv4Address') != null then 'networks']: {
|
||||
main: {
|
||||
ipv4_address: variation.ipv4Address,
|
||||
}
|
||||
},
|
||||
}) +
|
||||
utils.ComposeService(variation.name + '-' + suffix + '-ready', {
|
||||
image: 'jwilder/dockerize:0.6.1',
|
||||
|
|
|
@ -40,6 +40,12 @@ local Routes(mode, idp, dns_suffix) =
|
|||
to: 'tcp://redis' + dns_suffix + ':6379',
|
||||
allow_any_authenticated_user: true,
|
||||
},
|
||||
// specify https upstream by IP address
|
||||
{
|
||||
from: 'https://httpdetails-ip-address.localhost.pomerium.io',
|
||||
to: 'https://172.20.0.50:8443',
|
||||
allow_public_unauthenticated_access: true,
|
||||
},
|
||||
// tls_skip_verify
|
||||
{
|
||||
from: 'https://httpdetails.localhost.pomerium.io',
|
||||
|
|
|
@ -10,7 +10,11 @@ function(idp) utils.Merge([
|
|||
(import '../backends/websocket-echo.libsonnet')().compose,
|
||||
{
|
||||
networks: {
|
||||
main: {},
|
||||
main: {
|
||||
ipam: {
|
||||
config: [{subnet: "172.20.0.0/16"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
|
|
|
@ -10,7 +10,11 @@ function(idp) utils.Merge([
|
|||
(import '../backends/websocket-echo.libsonnet')().compose,
|
||||
{
|
||||
networks: {
|
||||
main: {},
|
||||
main: {
|
||||
ipam: {
|
||||
config: [{subnet: "172.20.0.0/16"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
|
|
28
integration/tpl/files/trusted-sans-key.pem
Normal file
28
integration/tpl/files/trusted-sans-key.pem
Normal file
|
@ -0,0 +1,28 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDilxaHaDYWtAA2
|
||||
HF8I9JjTxz+kehoyx2rx2ZnroOLC7qp7RkQodTDR8otcwyi5rtuiC1TR0/GGEqqi
|
||||
BtqU9YwtDSyisqOgHpmTvVpwdXGklKgQCXEKQZCZ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||||
+TGjK91qkHDakn3RuRE6eUT1IXraJVwvfWBdT6SVl4bjvDn7EcGh2XYSfD9c99+4
|
||||
nWUle7GtIB2XHR4c7VMmytqWeNbykQoY2/2evoRGUjUEFLR5sy1JJd9iVQKBgGEd
|
||||
Dctsx8lIQfueWbAGsgsecBUkrojsGPrHvdwY9vX9hOpwbL9jv+8rMbG3jqD3TgT4
|
||||
xZ16MQBwO3GKFBNxfJQbAEu1AOK2hiMOvtSXxDj7Yd0GDpQsxmjeSKcGRJqoOLQd
|
||||
Hv4OiXTrmtHJ8vrW6Iu2ZnmceNnaO/ee5hL7KyxFAoGAealomMLKdpx8sqU3x+q2
|
||||
+ZjwHcujFJAwMXXaAi/1cgln1JuVWr577t44VbfYNvaCQah4yZJqKpbzWzdJdatD
|
||||
JR855qFt2gBQBn6fwliFDB+e3Phrd4IwjwH3/sjl7Z7SB1ANj5DYXpceu7gaNlyZ
|
||||
/5jXf1x0Dk3QDs0JXbgJmPs=
|
||||
-----END PRIVATE KEY-----
|
27
integration/tpl/files/trusted-sans.pem
Normal file
27
integration/tpl/files/trusted-sans.pem
Normal file
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIEhDCCAuygAwIBAgIQX48RpK9MrVcpPDQc6AScZzANBgkqhkiG9w0BAQsFADCB
|
||||
gzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMSwwKgYDVQQLDCNjYWxl
|
||||
YkBjYWxlYi1wYy1saW51eCAoQ2FsZWIgRG94c2V5KTEzMDEGA1UEAwwqbWtjZXJ0
|
||||
IGNhbGViQGNhbGViLXBjLWxpbnV4IChDYWxlYiBEb3hzZXkpMB4XDTIxMDgxMDE3
|
||||
MzIxMFoXDTIzMTExMDE4MzIxMFowVzEnMCUGA1UEChMebWtjZXJ0IGRldmVsb3Bt
|
||||
ZW50IGNlcnRpZmljYXRlMSwwKgYDVQQLDCNjYWxlYkBjYWxlYi1wYy1saW51eCAo
|
||||
Q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EawFsqakizLtvNTU4I83AaJLFWGqTPGkl3H02RoD8DgXfLGvsoiUutNnf
|
||||
ISGHomD+3HlfHCLQtxQCgfyxT2J57yai+Ba+2HjsMTx5Q/a/7HqoEakxHff6Yf0J
|
||||
kaQ07lDuMg9Bmq+n6Yg4n4I7b9txE4nF71JWCGglPgKupuUJB1umGdN3eGgE3VWe
|
||||
8GSRvXCCVlQ=
|
||||
-----END CERTIFICATE-----
|
|
@ -96,8 +96,8 @@ local ParseURL(rawURL) =
|
|||
local ComposeService(name, definition, additionalAliases=[]) =
|
||||
{
|
||||
[name]: definition {
|
||||
networks: {
|
||||
main: {
|
||||
networks+: {
|
||||
main+: {
|
||||
aliases: [name] + additionalAliases,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue