-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Support for SPF #170
Comments
That should be something to add, indeed. I’m not sure where it should live – probably not in |
Ah, I see. I skimmed through the I'll do some first steps towards data struct(s) following RFC 7208 and keep you posted. |
Reading the RFC 7208, I'm wondering, what do we expect from the SPF support in As an example, lets consider this requirement from the RFC:
Should
My actual understanding is that @partim : What's your idea about that? |
An SPF record might contain IPv4 / IPv6 addresses. We could use |
I would indeed only want to have parsing/composing of the record data as part of domain. Parsing should probably be an iterator that returns terms. For composing, the usual strategy to provide a dedicated builder type atop an octets builder that has a This should indeed by |
I don't have much experience with I also checked some crates handling IP Networks and CIDR notation: looks like they all rely on So, I think the approach is to make this work on a low level, i. e. staying with |
The idea of I suppose you need the |
Thank you for pointing this out. I was not fully aware of this because I did not grasp the "cfg" statements in Thinking about CIDR (which is not available in std anyway), we could support it without additional dependencies by doing the math on our own. So, instead of introducing a new CIDR type,which would be specific to Example: if we had 192.168.1.1/24 in the SPF record, we would return 192.168.1.1 and 192.168.0.0. From the point of view of a library user, I would like to get the network address in this case and happy about getting it for free. What do you think? |
My current approach is to implement a Today I tested very long records with > 250 chars to understand the implications. I found no problems, as Another thing is that [RFC1035], Sections 3.3 and 3.3.14, define that a single text DNS record can be composed of more than one string. I was not able to create such a record with my DNS provider and I've never seen such records. I assume, I've to setup a DNS server to test this. The question is: do I have to take care of "multiple strings in a single TXT record" or is this done by the already available Txt implementation in |
(We need threads ;) )
I would rather have a dedicated type in the spf module if there isn’t a commonly accepted standard type for it. This can be very simple, just a struct with two public attributes. I think this is better than making assumptions or having the user deduce what was there. We have types for prefixes in the routecore crate, but I’m not convinced it should be a dependency for domain, even if optional.
Do you need the owner of the record? Otherwise, I would just base it on
I believe if you have a zone file like so:
then you will end up with a TXT record that has two character string one with Then you can very easily have a function that produces an iterator that essentially just flatmaps any iterator that returns |
@partim Thank you for your support. I'm not sure to fully understand but I'm trying to think in that direction. I'll work on a first implementation. Let's see how it goes. |
@partim With I've another question regarding domain names. Spf record might contain domain names and I thought I might be using Dname for them. However, when I created a Dname from a slice containing "google.com", I got "BadLabel" error. let domain = b"google.com".as_slice();
println!("Domain: {}", Dname::from_slice(domain).unwrap()); => I figure that Dname can only be used for domain names as part of DNS requests / replies? What type would you suggest to use for domain names? |
Correct.
|
Ok, that's fine. I guess we also keep macros as strings, e.g. %{d} which refers to the domain?! So, basically |
I want to say draw the line at tokens and leave their interpretation to external code? We probably shouldn’t include too much code that isn’t strictly DNS. |
Not sure if I should mention it. But I have an SPF deconstruct crate. |
@Bas-Man You definitely should! Maybe this is all that @tokcum needs? It seems your crate uses |
I am. I might need some guidance regarding using bytes. |
We are using the octseq for being generic over the type of octets sequence to be used. So instead of, say, just Ideally you whouldn’t use If you need some inspiration, perhaps have a look at domain’s But, this is just how domain does things to stay open to more use cases. If you just want to switch out |
Working on a @partim, yes, the type I'm working on is Sorry, I'm not very fast in programming due to other obligations. @Bas-Man, no worries, when you are faster then me, that's not a problem for me, as my motivation is learning first and public recognition second. |
My goal is also learning and contributing. Recognition does not enter into the equation. I am new to rust still to be honest. |
@tokcum Would it be possible to look at your code so that I can learn as well. I have not tried no_std. |
@Bas-Man, welcome to the party. To be honest, I'm not even a professional developer. I'm in Security, that's why I love rust. Sure. I'll beautify my code this weekend and let you know when I've updated my fork. For raising a proper PR I'll need more time, though. |
@tokcum No rush! If you would like some early feedback, you can always open a PR and mark it as a draft. |
Hi,
I'm looking into adding support for SPF to domain. I've seen that TXT records are already supported. I think it would be great if domain could serialize and deserialize SPF records according to RFC7208.
I'm planning to create a tool to check SPF records. However, I think serializing / deserializing SPF records should be placed in domain.
Looking at the code structure of domain, I guess the approach would be to add a module rdata::rfc7208 which relies on rdata::rfc1035::Txt.
Let me know what you think.
The text was updated successfully, but these errors were encountered: