Mercurial > hg > nginx-tests
annotate mail_proxy_protocol.t @ 1971:ab45ee8011df
Tests: guarded session ticket tests for old OpenSSL versions.
Much like SNI support, TLS session tickets are available starting with
OpenSSL 0.9.8f if TLS extensions support is explicitly configured, and
enabled by default since 0.9.8j. As such, SNI availability is checked
to ensure TLS extensions support is compiled in.
Additionally, the ssl_session_ticket_key.t tests for automatic ticket key
rotation, which uses session ticket key callback, as introduced in
OpenSSL 0.9.8h.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 May 2024 00:03:16 +0300 |
parents | 5ac6efbe5552 |
children |
rev | line source |
---|---|
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for mail proxy module, PROXY protocol with realip. |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use MIME::Base64; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 use Test::Nginx::SMTP; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 ############################################################################### |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDERR; $| = 1; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 select STDOUT; $| = 1; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 local $SIG{PIPE} = 'IGNORE'; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/) |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 ->write_file_expand('nginx.conf', <<'EOF'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 %%TEST_GLOBALS%% |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 daemon off; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 events { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 mail { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 proxy_pass_error_message on; |
1679
74986ebee2fd
Tests: added proxy_timeout in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1660
diff
changeset
|
42 proxy_timeout 15s; |
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 proxy_smtp_auth on; |
1660
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
44 proxy_protocol on; |
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 auth_http http://127.0.0.1:8080/mail/auth; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 smtp_auth login plain; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 server { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 listen 127.0.0.1:8025 proxy_protocol; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 protocol smtp; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 auth_http_header X-Type proxy; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 server { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 listen 127.0.0.1:8027 proxy_protocol; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 protocol smtp; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 set_real_ip_from 127.0.0.1/32; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 auth_http_header X-Type realip; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 http { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 %%TEST_GLOBALS_HTTP%% |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 server { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 listen 127.0.0.1:8080; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 server_name localhost; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 location = /mail/auth { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 set $reply ERROR; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 set $test $http_x_type:$http_client_ip:$http_proxy_protocol_addr; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 if ($test = proxy:127.0.0.1:192.0.2.1) { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 set $reply OK; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 if ($test = realip:192.0.2.1:192.0.2.1) { |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 set $reply OK; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 add_header Auth-Status $reply; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 add_header Auth-Server 127.0.0.1; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 add_header Auth-Port %%PORT_8026%%; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 add_header Auth-Wait 1; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 return 204; |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 } |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 EOF |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1679
diff
changeset
|
95 $t->run()->plan(8); |
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 $t->waitforsocket('127.0.0.1:' . port(8026)); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 ############################################################################### |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 # connection with PROXY protocol |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 my $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8025)); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 $s->send('PROXY TCP4 192.0.2.1 192.0.2.2 123 5678'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 $s->check(qr/^220 /, "greeting with proxy_protocol"); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 $s->send('EHLO example.com'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 $s->check(qr/^250 /, "ehlo with proxy_protocol"); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 $s->authok('auth with proxy_protocol'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
1660
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
113 $s->send('XPROXY'); |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
114 $s->check(qr/^211 PROXY TCP4 127.0.0.1 127.0.0.1 \d+ \d+/, |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
115 'proxy protocol to backend'); |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
116 |
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 # connection with PROXY protocol and set_realip_from |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027)); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 $s->send('PROXY TCP4 192.0.2.1 192.0.2.2 123 5678'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 $s->check(qr/^220 /, "greeting with proxy_protocol and realip"); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 $s->send('EHLO example.com'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 $s->check(qr/^250 /, "ehlo with proxy_protocol and realip"); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 $s->authok('auth with proxy_protocol and realip'); |
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 |
1660
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
130 $s->send('XPROXY'); |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
131 $s->check(qr/^211 PROXY TCP4 192.0.2.1 127.0.0.1 \d+ \d+/, |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
132 'proxy_protocol to backend and realip'); |
068c30e9d2c6
Tests: smtp tests with proxy protocol to backend.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1659
diff
changeset
|
133 |
1659
d1c4059e1e72
Tests: smtp tests with proxy protocol and realip.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 ############################################################################### |