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

Dns.Dnskey.pp_name_key and Dns.Dnskey.name_key_of_string are not isomorph #355

Closed
dinosaure opened this issue Oct 21, 2024 · 2 comments · Fixed by #356 or ocaml/opam-repository#26773

Comments

@dinosaure
Copy link
Member

Actually used in tlstunnel:

          D.retrieve_certificate pub ~dns_key:(Fmt.to_to_string Dns.Dnskey.pp_name_key (K.dns_key ()))

It seems that Dns.Dnskey.pp_name_key does not put the ::

ocaml-dns/src/dns.ml

Lines 911 to 912 in 0d7fe18

let pp_name_key ppf (name, key) =
Fmt.pf ppf "%a %a" Domain_name.pp name pp key

Which seems required for Dns.Dnskey.name_key_of_string:

ocaml-dns/src/dns.ml

Lines 903 to 909 in 0d7fe18

let name_key_of_string str =
match String.split_on_char ':' str with
| name :: key ->
let* name = Domain_name.of_string name in
let* dnskey = of_string (String.concat ":" key) in
Ok (name, dnskey)
| [] -> Error (`Msg ("couldn't parse name:key in " ^ str))

Not sure why it's work for tlstunnel but it does not work on my STMP stack.

@hannesm
Copy link
Member

hannesm commented Oct 22, 2024

Thanks. So, I digged a bit deeper, and it never worked for tlstunnel. Thanks for discovering this issue. I opened #356 to provide such dual functions.

@hannesm
Copy link
Member

hannesm commented Oct 22, 2024

We didn't notice in tlstunnel since we're still using an old image which predates the change (introduced in robur-coop/tlstunnel@b9a7183) -- before that it was just a string.

hannesm added a commit to hannesm/opam-repository that referenced this issue Oct 22, 2024
CHANGES:

* Dns.Dnskey: provide to_string and name_key_to_string (@hannesm, @dinosaure,
  mirage/ocaml-dns#356 - fixes mirage/ocaml-dns#355)
* BREAKING: Dns.Dnskey remove pp_name_key (unused, irritating, mirage/ocaml-dns#356)
* BREAKING Dns_certify_mirage.retrieve_certificate use separate dns_key_name
  and dns_key arguments, avoid string decoding in that function (mirage/ocaml-dns#356)
RyanGibb added a commit to RyanGibb/ocaml-dns that referenced this issue Nov 18, 2024
Release 9.1.0

CHANGES:

* Dns.Dnskey: provide to_string and name_key_to_string (@hannesm, @dinosaure,
  mirage#356 - fixes mirage#355)
* BREAKING: Dns.Dnskey remove pp_name_key (unused, irritating, mirage#356)
* BREAKING Dns_certify_mirage.retrieve_certificate use separate dns_key_name
  and dns_key arguments, avoid string decoding in that function (mirage#356)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants