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

net-dns/dnscrypt-proxy: simplify init, follow upstream recommendations. #5346

Closed
wants to merge 2 commits into from

Conversation

gyakovlev
Copy link
Member

Modify dnscrypt-proxy ebuild to follow upstream recommendation of using config file over command line arguments.
Currently only with config file one can specify advanced options like Cache, Forward domains and more.
This greatly simplifies the init script removing unnecessary bashism and boilerplate.
Allows to make symlinks to run several instances.
Adds proper socket activation for systemd as upstream intended.
Ships with a config file that works out of the box and selects random provider that does not log queries and supports dnssec.

Adding myself as a secondary maintainer as discussed with @mgorny on irc.
Also ping my proxy @Polynomial-C

@gentoo-repo-qa-bot gentoo-repo-qa-bot added the assigned PR successfully assigned to the package maintainer(s). label Aug 7, 2017
@Polynomial-C
Copy link
Contributor

Looking at the differences between net-dns/dnscrypt-proxy-1.9.5 and net-dns/dnscrypt-proxy-1.9.5-r1 why don't you simply merge the -r1 ebuild into the -r0 ebuild?

@gyakovlev
Copy link
Member Author

My thoughts we that since I rework the ebuild significantly I'd bump a version with current approach and introduce my changes with -r1 to discuss here.
If it's not necessary I can move it into r0 and squash.

@Polynomial-C
Copy link
Contributor

Yeah, please do that.

@gyakovlev gyakovlev force-pushed the dnscrypt_simplification branch 3 times, most recently from 348ab36 to 02ea860 Compare August 15, 2017 07:53
@gyakovlev
Copy link
Member Author

done.
forgot to push fresh manifest, bot caught this.

i don't like confusing names of the updated files in the files dir, but I guess i have no choice until 1.9.4 ebuild is deleted.

@Polynomial-C
Copy link
Contributor

Please name the ebuild dnscrypt-proxy-1.9.5.ebuild and not dnscrypt-proxy-1.9.5-r1.ebuild

DEPEND="${RDEPEND}
virtual/pkgconfig"

DOCS="AUTHORS ChangeLog NEWS README* THANKS *txt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since EAPI-6 wildcards are not allowed in global scope. If you really need the wildcards, move the DOCS variable into src_install() and make it local. You could also consider to make it an array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed the ebuild, I was going to change it as I squashed but lost that change during squashing.
also moved DOCS into src_install and made it an array.

@gyakovlev
Copy link
Member Author

I've made DOCS a local and made it an array. My previous comment here vanished with another rebase.


## Write the PID number to a file

PidFile /var/run/dnscrypt-proxy.pid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest leaving the PidFile out of the configuration file, and instead passing it on the command-line (which would override the one in the config file anyway). The reason is, in the init script, you define

pidfile="/var/run/${SVCNAME}.pid"

But what happens if the user changed the PidFile line in the config file? The init script stops working =(
Don't ask why, but people actually do that. Instead, I would pass the existing $pidfile variable to the daemon:

command_args="${DNSCRYPT_OPTS} --pidfile="${pidfile}"

That way the PID file that start-stop-daemon uses is guaranteed to be the one that dnscrypt-proxy uses.

An unrelated note: the /var/run directory is being migrated to simply /run, so now is as good a time as any to make that change.

## run the server as a less-privileged system user.
## The value for this parameter is a user name.

User dnscrypt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since your ebuild creates the dnscrypt user, you might consider forcing the daemon to run as that user (by passing it on the command line). Then you could get rid of this setting so that people don't change it and break the init script. For example,

command_args="${DNSCRYPT_OPTS} --pidfile="${pidfile} --user=dnscrypt"

I'm not nearly as sure about this one though, so it's up to you.

Copy link
Member Author

@gyakovlev gyakovlev Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlitzky That's not possible.
Dnscrypt will only take either config file or command line parameters. Not both.
That's why I had to create a config file. It allows to use cache, bypass domains and more.
I don't know if it's on purpose or just temporary limitation, I'll ask upstream and check their github issues.

It makes a perfect sense to override pid file and user in conf.d but unfortunately not possible now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found.
DNSCrypt/dnscrypt-proxy#607
so it's intended.
It's actually possible to enable cache and other features using command line by passing magic parameters but it quickly becomes quite cumbersome.
Upstream advises to use config file by default, so I decided to ship a sensible working config with random secure resolver. It works out of the box, just need to update /etc/resolv.conf to point to 127.0.0.1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks, I didn't know that it was one-or-the-other. Forget everything I said =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sidenote:
It's still possible to run dual resolvers with config file.
One can symlink the initscript, copy conf.d file and point it to another config file with unique PidFile, LocalAddress and optionally syslog prefix.
That's not ideal but works.

I'll push a change placing pidfile it to /run/. Makes sense.

@soredake
Copy link
Contributor

ping

@Polynomial-C
Copy link
Contributor

Meanwhile metadata.xml file has been changed. Can you please adjust your PR accordingly so I can add it cleanly?

Greatly simplify initscript to allow symlinking of unit files
for openrc. This approach follows upstream recommendation to
use config file instead of command line args.
Also proper systemd unit with socket activation from upstream.
Fixes 588462

Bug: https://bugs.gentoo.org/show_bug.cgi?id=588462
Request maintanership. Add my proxy as well.
@gentoo-repo-qa-bot
Copy link
Collaborator

😞 The QA check for this pull request has found the following issues:

Issues inherited from Gentoo (may be modified by PR):
https://qa-reports.gentoo.org/output/gentoo-ci/18c334f42/output.html#dev-util/webstorm

@mgorny mgorny removed the assigned PR successfully assigned to the package maintainer(s). label Nov 4, 2017
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull Request assignment

Areas affected: ebuilds
Packages affected: net-dns/dnscrypt-proxy

net-dns/dnscrypt-proxy: @gentoo/proxy-maint (maintainer needed)

Bugs linked: 588462

@gentoo-repo-qa-bot gentoo-repo-qa-bot added maintainer-needed There is at least one affected package with no maintainer. Review it if you can. assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. labels Nov 4, 2017
@gyakovlev
Copy link
Member Author

@Polynomial-C ping, I've rebased for a clean merge.

@gentoo-bot gentoo-bot closed this in 0ee515f Nov 7, 2017
gentoo-bot pushed a commit that referenced this pull request Nov 7, 2017
Request maintanership. Add my proxy as well.
Closes: #5346
@gyakovlev gyakovlev deleted the dnscrypt_simplification branch November 19, 2017 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. maintainer-needed There is at least one affected package with no maintainer. Review it if you can.
Projects
None yet
6 participants