Giter Site home page Giter Site logo

desec-dns's People

Contributors

brueggus avatar davidmehren avatar patrickfl avatar s-hamann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

desec-dns's Issues

TypeError: Argument 'text' has incorrect type (expected str, got _io.TextIOWrapper)

> ... | python desec.py --token-file /proc/self/fd/0 import-zone -f ~/backups/zones/whynothugo.nl -d whynothugo.nl
Traceback (most recent call last):
  File "/home/hugo/src/github.com/s-hamann/desec-dns/desec.py", line 1280, in <module>
    main()
  File "/home/hugo/src/github.com/s-hamann/desec-dns/desec.py", line 1254, in main
    record_list = parse_zone_file(arguments.file, arguments.domain,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hugo/src/github.com/s-hamann/desec-dns/desec.py", line 731, in parse_zone_file
    parsed_zone = zone.from_file(path, origin=domain, relativize=False, check_origin=False)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "dns/zone.py", line 1326, in dns.zone.from_file
  File "dns/zone.py", line 1327, in dns.zone.from_file
TypeError: Argument 'text' has incorrect type (expected str, got _io.TextIOWrapper)
  • Python 3.11.7
  • dnspython-2.4.2
  • requests-2.31.0
  • cryptography-41.0.7

No support for zone files with newlines.

Problem

Importing an RFC-abiding zone file with newlines causes an error.

Steps to reproduce

  1. Paste the above into a zone file
  2. Run the script

Expected result

  • The zone file is parsed correctly

Actual result

Invalid line 2022012802 ; serial
 in zone file.

Further context

In the RFC, it's stated that a record in a zone file should be in one line, except if the record data is enclosed in ():

From https://datatracker.ietf.org/doc/html/rfc1035

5.1. Format
[...]
( )             Parentheses are used to group data that crosses a line
                boundary.  In effect, line terminations are not
                recognized within parentheses.

. So, for example, this is valid zone file format:

example.com. 43200 IN SOA ns1.dnsprovider.com. hostmaster.dnsprovider.com. (
2022012802 ; serial
14400 ; refresh (4 hours)
3600 ; retry (1 hour)
2419000 ; expire (3 weeks 6 days 23 hours 56 minutes 40 seconds)
43200 ; minimum (12 hours)
)
43200 RRSIG SOA 8 2 43200 (
20220227064000 20220128064000 16839 example.com.
01234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef
01234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef
== )

However, desec.py expects everything on one line, causing failure here aleady on line 2.

Also, from looking at the code, it looks like comments that don't start at the beginning of the line (as in the example above) are not handled correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.