-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
nixos/darkhttpd: change listening address default to ::1 #353402
base: master
Are you sure you want to change the base?
Conversation
We unconditionally pass --ipv6 to the binary. In older versions, setting both --addr 127.0.0.1 and --ipv6 resulted in listening on [::], a potential security issue. On the other hand, the binary started. With the current version however, --ipv6 implies an IPv6 address in --addr resulting in a crash with: "darkhttpd: malformed --addr argument" While this commit is technically a BC-break, it should be harmless as existing users either do not explicitly set the address and the server refuses the start (making this change rather a fix) or they set the address and are therefore unaffected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense and LGTM!
This does not seem to have ever been intended, it was probably caused by the same parsing issue as described in commit abdadde Listening on [::] makes darkhttpd see IPv4 connections under ::ffff:a.b.c.d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense as a fix for the most common behavior (ipv6 enabled).
Machines without ipv6 do currently work correct? The PR change will break such setups with a default binding?
It seems the default should ideally be dependent on the enableipv6 option?
@@ -27,11 +27,11 @@ in { | |||
}; | |||
|
|||
address = mkOption { | |||
default = "127.0.0.1"; | |||
default = "::1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default = "::1"; | |
default = if config.networking.enableIPv6 then "::1" else "127.0.0.1"; | |
defaultText = lib.literalExpresison ''if config.networking.enableIPv6 then "::1" else "127.0.0.1"''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we would also have to adjust:
We unconditionally pass --ipv6 to the binary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 probably, I am unsure
@bobvanderlinden @SuperSandro2000 Oh I completely forgot about machines without IPv6. In such a case I don't think we should detect IPv6 status by the I therefore propose to add another config options for darkhttpd to decide whether to enable IPv6 support. It would default to |
We unconditionally pass --ipv6 to the binary. In older versions, setting both --addr 127.0.0.1 and --ipv6 resulted in listening on [::], a potential security issue. On the other hand, the binary started.
With the current version however, --ipv6 implies an IPv6 address in --addr resulting in a crash with: "darkhttpd: malformed --addr argument"
While this commit is technically a BC-break, it should be harmless as existing users either do not explicitly set the address and the server refuses the start (making this change rather a fix) or they set the address and are therefore unaffected.
The above excerpt from the commit message shall summarize the changes well. I just want to add that the this is not a BC-break, this is a bug fix shall qualify it for merging despite the freeze in #339153.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.