infrared icon indicating copy to clipboard operation
infrared copied to clipboard

SRV records may not be routed correctly.

Open viasnake opened this issue 1 year ago • 3 comments

Describe the bug When using SRV records, the domain of the target is referenced. As a result, routing does not work correctly.

To Reproduce OS: Ubuntu 22.04.2 LTS (ARM) Infrared Version: ghcr.io/haveachin/infrared:2.0.0-alpha.13 Docker compose:

version: '3'

services:
  infrared:
    image: ghcr.io/haveachin/infrared:2.0.0-alpha.13
    volumes:
      - ./infrared:/infrared
    ports:
      - target: 25565
        published: 25565
        protocol: tcp
        mode: host
    environment:
      INFRARED_CONFIG_PATH: "/configs"
    deploy:
      mode: global

Infrared Config: server.yml

java:
  gateways:
    default:
      listeners:
        default:
          bind: :25565
  servers:
    server1:
      gateways:
        - default
      domains:
        - "mc1.example.com"
      address: 192.0.2.1:25565
      sendProxyProtocol: true
    server2:
      gateways:
        - default
      domains:
        - "servers.example.com"
      address: 192.0.2.2:25565
      sendProxyProtocol: true
    server3:
      gateways:
        - default
      domains:
        - "*"
      address: 192.0.2.3:25565
      sendProxyProtocol: true

How do you trigger the bug/issue?:

  1. After a basic set-up of Infrared, set up the Infrared config.
  2. DNS configuration. Shown below is the case for example.com.
;; A Records
servers.example.com.	1	IN	A	203.0.113.1
servers.example.com.	1	IN	A	203.0.113.2
servers.example.com.	1	IN	A	203.0.113.3
servers.example.com.	1	IN	A	203.0.113.4

;; SRV Records
_minecraft._tcp.mc1.example.com.	1	IN	SRV	1 100 25565 servers.example.com.
  1. Connect to the Minecraft server at mc1.example.com. You will then be connected to 192.0.2.2:25565.

Expected behavior If you connect on mc1.example.com, you will be routed to 192.0.2.1:25565.

Additional context I have only checked this with the Java Edition; it is possible that the Bedrock Editon may behave similarly, but since the Bedrock Edition does not allow the use of SRV records, I don't think this will be an issue.

viasnake avatar Mar 08 '23 05:03 viasnake