dnschef
dnschef copied to clipboard
Multiple SRV records with different port and target not allowed
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.
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
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 https://github.com/iphelix/dnschef/blob/a395411ae1f5c262d0b80d06a45a445f696f3243/dnschef.py#L525
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
Sorry I forgot to comment here, I confirm the above bad behaviour and that's why I am still using the 0.3 version.
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.
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!