Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple SRV records with different port and target not allowed #26

Open
irsdl opened this issue Jul 21, 2020 · 5 comments
Open

Multiple SRV records with different port and target not allowed #26

irsdl opened this issue Jul 21, 2020 · 5 comments

Comments

@irsdl
Copy link

irsdl commented Jul 21, 2020

I am receiving a record duplicate error when trying to define a SRV record on different ports or to different targets.

Example 1:

_ldap._tcp.dc._msdcs.test123.local=0 50 389 test123.local
_ldap._tcp.dc._msdcs.test123.local=0 50 53 test123.local

Example 2:

_ldap._tcp.dc._msdcs.test123.local=0 50 389 test123.local
_ldap._tcp.dc._msdcs.test123.local=0 50 389 foo.test123.local

Error message is:

Traceback (most recent call last):
  File "dnschef.py", line 516, in <module>
    config.read(options.file)
  File "c:\pythonPath\lib\configparser.py", line 697, in read
    self._read(fp, filename)
  File "c:\pythonPath\lib\configparser.py", line 1093, in _read
    raise DuplicateOptionError(sectname, optname,
configparser.DuplicateOptionError: While reading from '../dnschef.ini' [line 54]: option '_ldap._tcp.dc._msdcs.test123.local' in section 'SRV' already exists

This setting should be allowed and another example can be seen in https://en.wikipedia.org/wiki/SRV_record

Note: I can use the executable version in windows (0.3) and it does not show me any error.

@irsdl
Copy link
Author

irsdl commented Jul 21, 2020

This issue can be fixed by changing:

config = ConfigParser()

To:

config = ConfigParser(strict=False)

More info: https://docs.python.org/3.4/library/configparser.html

@amard33p
Copy link

amard33p commented Aug 25, 2020

This issue can be fixed by changing:

config = ConfigParser()

To:

config = ConfigParser(strict=False)

More info: https://docs.python.org/3.4/library/configparser.html

I too have this issue...but using strict=False does not fix it. It merely allows the server to run. But when you query for the SRV with nslookup, only the last record is returned.

Reason
The nametodns dictionary

nametodns[section][domain] = record

loads SRV records like this:
'SRV': {'_http._tcp.thesprawl.org': '1 5 5070 www.fake1.com'}

It's not possible to express multiple SRV records with same service name using above structure:

[SRV]
; FORMAT: priority weight port target
_http._tcp.thesprawl.org=0 5 5060 www.fake1.com
_http._tcp.thesprawl.org=1 5 5070 www.fake2.com

@irsdl
Copy link
Author

irsdl commented Aug 25, 2020

Sorry I forgot to comment here, I confirm the above bad behaviour and that's why I am still using the 0.3 version.

@amard33p
Copy link

Sorry I forgot to comment here, I confirm the above bad behaviour and that's why I am still using the 0.3 version.

I believe you are referring to this commit.
Even with v 0.3, it only returns the last entry of the [SRV] section only

[SRV]
; FORMAT: priority weight port target
_http._tcp.thesprawl.org=0 5 5060 www.fake1.com
_http._tcp.thesprawl.org=1 5 5070 www.fake2.com
[root@ub18-01:~] nslookup -type=SRV _http._tcp.thesprawl.org
Server:         127.0.0.1
Address:        127.0.0.1#53

_http._tcp.thesprawl.org        service = 1 5 5070 www.fake2.com.

@irsdl
Copy link
Author

irsdl commented Aug 25, 2020

I ran it once again (windows version 0.3) to see what I did previously, it seems it did only use the last entry as you said!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants