-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
blocky 0.20 (new formula) #120963
blocky 0.20 (new formula) #120963
Conversation
blocky is gaining popularity as an adblocking DNS server. The configurations included in the formula (for HEAD and stable) don't provide adblocking; only a basic DNS proxy is configured however users can build off of that functional setup. The service runs on port 53 as root instead of the default unprivileged 5353 port because MacOS doesn't allow a port to be specified using networksetup ( |
Formula/blocky.rb
Outdated
depends_on "go" => :build | ||
|
||
def install | ||
system "go", "build", *std_go_args, "-o", sbin/"blocky" |
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.
system "go", "build", *std_go_args, "-o", sbin/"blocky" | |
ldflags = %W[ | |
-s -w | |
-X github.com/0xERR0R/blocky/util.Version=#{version} | |
-X github.com/0xERR0R/blocky/util.BuildTime=#{time.iso8601} | |
] | |
system "go", "build", *std_go_args(ldflags:ldflags, output: sbin/"blocky") |
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.
The binary can runs in both client and server mode, so why not create the binary in bin
, and symlink to sbin for server usage?
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.
You do need both version and buildtime for version output, unfortunately, it looks like architecture is not dynamically overridable
$ /opt/homebrew/Cellar/blocky/0.20/sbin/blocky version
blocky
Version: 0.20
Build time: 2022-11-12T20:39:38Z
Architecture: undefined
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.
A symlink was added for sbin
to the version path. Was that what you were suggesting?
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.
Architecture used to be set with ${ARCHITECTURE}
but now it's ${GOARCH}${GOARM}
.
https://github.com/0xERR0R/blocky/blob/master/Makefile#L15-L20
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.
We should setup those build environment variables.
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.
A relatively comprehensive list of Golang-related environment variables - https://pkg.go.dev/cmd/go#hdr-Environment_variables.
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Formula/blocky.rb
Outdated
config_yml = if build.head? | ||
<<~EOF_HEAD | ||
# Reference the example config in the docs for all options | ||
# https://github.com/0xERR0R/blocky/blob/development/docs/config.yml | ||
ports: | ||
dns: "127.0.0.1:53,[::1]:53" | ||
upstream: | ||
default: | ||
- 1.1.1.1 | ||
- 1.0.0.1 | ||
bootstrapDns: | ||
- tcp+udp:1.1.1.1 | ||
- https://1.1.1.1/dns-query | ||
log: | ||
level: info | ||
format: text | ||
timestamp: true | ||
privacy: false | ||
EOF_HEAD | ||
else | ||
<<~EOF_STABLE | ||
# Reference the example config in the docs for all options | ||
# https://github.com/0xERR0R/blocky/blob/v0.20/docs/config.yml | ||
port: "127.0.0.1:53,[::1]:53" | ||
upstream: | ||
default: | ||
- 1.1.1.1 | ||
- 1.0.0.1 | ||
bootstrapDns: tcp+udp:1.1.1.1 | ||
logLevel: info | ||
logFormat: text | ||
logTimestamp: true | ||
logPrivacy: false | ||
EOF_STABLE | ||
end |
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.
If upstream doesn't ship one, homebrew shouldn't either
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.
The issue is that the service listens on 0.0.0.0
by default, leaving users vulnerable to external requests to sensitive or prohibited domains in their country. What do you recommend?
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.
I recommend upstream ship a config file or change the default.
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.
yeah, let's PR that config into the upstream, it would benefit the other package managers as well. :)
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.
I submitted that request to the blocky project. 0xERR0R/blocky#839
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.
We need to wait for a new release with the latest config format changes because some fields have changed in HEAD from the 0.20 release. For instance port
is now ports
and logLevel
/logFormat
/logTimestamp
are now in the log
hash.
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.
Sounds good, thanks!! 👍
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.
Doesn't macOS ask users if they want to allow the service to accept incoming network connections? Maybe running blocky without a default config is acceptable since the user decides if they want to allow external access.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?https://github.com/0xERR0R/blocky