Le 29/05/2024 à 14:45, Kirill A. Korinsky a écrit :
On Wed, 29 May 2024 12:19:15 +0100,
Joel Carnat <j...@carnat.net> wrote:
Is there a way to specify a User-Agent value for the check http or shall I rather tell
relayd to validate on "code 418"?
here two possible way to overstep it.
1. Use `check script /some/script` which uses curl, wget, ftp or any other
way to make HTTP call which is accepted by that server.
2. Use `check send "HEAD /health HTTP/1.1\r\nHost: host\r\nUser-Agent: dummy\r\n\r\n"
expect "200 OK HTTP/1.1"`
(I haven't tested it, it may contains typos, but it should make an idea)
Thank you! I went for solution 2 but it seems the string is not send
properly by relayd.
Using the console, I get a proper reply from the server:
# echo -n "HEAD /health HTTP/1.1\r\nHost: test.home.arpa\r\nUser-Agent:
relayd/7.5\r\n\r\n" | nc 192.168.0.125 8080 | head
HTTP/1.1 200 OK
Cache-Control: no-store
A tcpdump looks like:
00:00:00.000396 IP 192.168.0.201.42445 > 192.168.0.125.8080: Flags
[P.], seq 1:70, ack 1, win 256, options [nop,nop,TS val 3095794693 ecr
1], length 69: HTTP: HEAD /health HTTP/1.1
E..y.:@.@..........}......k.*..%....I%.....
........HEAD /health HTTP/1.1
Host: test.home.arpa
User-Agent: relayd/7.5
00:00:00.001924 IP 192.168.0.125.8080 > 192.168.0.201.42445: Flags
[P.], seq 1:379, ack 70, win 4197, options [nop,nop,TS val 1 ecr
3095794693], length 378: HTTP: HTTP/1.1 200 OK
E.....@.@......}........*..%..l....e.`.....
........HTTP/1.1 200 OK
Cache-Control: no-store
Copy/Pasting the HTTP request into relayd this way, the backend server
does not accept it:
check send "HEAD /health HTTP/1.1\r\nHost: test.home.arpa\r\nUser-Agent:
relayd/7.5\r\n\r\n" expect "HTTP/1.1 200 OK"
A tcpdump looks like:
00:00:00.003641 IP 192.168.0.201.6097 > 192.168.0.125.8080: Flags
[P.], seq 1:78, ack 1, win 256, options [nop,nop,TS val 3359675463 ecr
1], length 77: HTTP: HEAD /health HTTP/1.1\r\nHost:
test.home.arpa\r\nUser-Agent: relayd/7.5\r\n\r\n[!http]
E....I@.@..........}....D.&...(j....f......
.@.G....HEAD /health HTTP/1.1\r\nHost: test.home.arpa\r\nUser-Agent:
relayd/7.5\r\n\r\n
00:00:00.196735 IP 192.168.0.125.8080 > 192.168.0.201.6097: Flags [.],
ack 78, win 4197, options [nop,nop,TS val 2 ecr 3359675463], length 0
E..4..@.@..,...}..........(jD.'J...e.......
.....@.G
00:00:00.008892 IP 192.168.0.201.6097 > 192.168.0.125.8080: Flags
[F.], seq 78, ack 1, win 256, options [nop,nop,TS val 3359675673 ecr 2],
length 0
E..4..@.@..[.......}....D.'J..(j...........
.@......
00:00:00.000066 IP 192.168.0.125.8080 > 192.168.0.201.6097: Flags [.],
ack 79, win 4197, options [nop,nop,TS val 2 ecr 3359675673], length 0
E..4..@.@..,...}..........(jD.'K...e.......
.....@..
00:00:00.000411 IP 192.168.0.125.8080 > 192.168.0.201.6097: Flags
[P.], seq 1:104, ack 79, win 4197, options [nop,nop,TS val 2 ecr
3359675673], length 103: HTTP: HTTP/1.1 400 Bad Request
E.....@.@......}..........(jD.'K...e$......
.....@..HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Connection: close
Using single quotes or real CRLF in the relayd configuration does not
solve this issue.
I'd rather not use the script option as I fear this would lead to lots
of forks :-/
Regards,
Joel C.