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

makeKey can not be redirected using shell #8130

Closed
Gunni opened this issue Jul 27, 2019 · 0 comments · Fixed by #8131
Closed

makeKey can not be redirected using shell #8130

Gunni opened this issue Jul 27, 2019 · 0 comments · Fixed by #8131

Comments

@Gunni
Copy link

Gunni commented Jul 27, 2019

  • Program: dnsdist
  • Issue type: Bug report

Short description

I was attempting to use echo "makeKey()" | dnsdist to get a usable console key, it works, but when I then did echo "makeKey()" | dnsdist | grep setKey it stopped working.

Environment

  • Operating system: Fedora 30
  • Software version: 1.3.3 (Lua 5.1.4 [LuaJIT 2.1.0-beta3]) with dns-over-tls(openssl) dnscrypt ebpf libsodium protobuf recvmmsg/sendmmsg systemd
  • Software source: Operating system repository

Steps to reproduce

  1. echo "makeKey()" | dnsdist works
  2. echo "makeKey()" | dnsdist -C /dev/null works (config is not relevant)
  3. echo "makeKey()" | dnsdist | cat does not work, because setKey is not printed when piped

Expected behaviour

The setKey line gets printed.

Actual behaviour

The setKey does not get printed when stdout/stderr is redirected.

Other information

makeKey is implemented here but I can not find where g_outputBuffer is printed.

Usecase

My idea was to make ansible run echo "makeKey()" | dnsdist | grep setKey > /etc/dnsdist/key/key.conf if it didn't exist and then to do a includeDirectory /etc/dnsdist/key in the main config file.

Description

It would be nice if there was a dnsdist --print-new-key command that just printed a new key, no reading configs, or starting the server or listening on sockets or anything.

dwfreed added a commit to dwfreed/pdns that referenced this issue Jul 27, 2019
cout may not be a tty, in which case it is block buffered by stdlib, so
flush it after printing g_outputBuffer.

Fixes PowerDNS#8130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants