-
Notifications
You must be signed in to change notification settings - Fork 59
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
Asking kresd about its configuration, notably its configured upstream servers #122
Comments
Your command fails because the control socket executes the input line-by-line. That's why the like with The easiest way is probably to paste such stuff directly into your config file.
It's impossible to ask that. The configuration constructs generic Lua functions that set some stuff. It's impossible to introspect that, among loads of other advantages. That's price of the flexibility of Lua. We're now trying to push people from Lua to YAML for 99% of their configs: https://en.blog.nic.cz/2023/12/15/knot-resolver-6-x-news/ But those huge changes haven't reached Turris defaults yet. (I recognize your face from forum.turris.cz.) On Turris in particular I'd simply look at the |
Wow, thanks, it's in Interesting though that introspection isn't possible. Given this code is cited in the the issue I linked to aove:
So they are printing |
Sure, a little information is there, but you can't show lua closures/functions and what you need is hidden inside those. |
What the policy config is that you construct some functions, store them in this array and then execute them on every request. It's too generic; those functions could do anything. |
Three quick questions while we're here (because I am always curious):
In conclusion, the socket can only process lua that is expressible on one line of lua (it even fails if I write a function on one line I also see in exander77's sample that yes he defines the function in the config (where would he put that?) and then uses a one-liner to call it on the socket.
the two IPv6 addresses puzzle me. I'm informed that '2620:fe::fe' and '2620:fe::9' are IPv6 ULAs (Unique Local Addresses, tha apparent IPv6 equivalent of 19.168.. and 10...* in the IPv4 world? Why would quad9.net be providing those? Or have htose configured? Or have I misunderstood Ipv6? (easy to imagine, I'm new to it). |
|
The configuration file and control socket commands are just a lua scripts that get executed in the global context that lives as long as the daemon. You can do whatever in there, e.g. define functions. |
I forgot to mention that on Turris you can add custom parts to the configuration like this: https://wiki.turris.cz/en/public/dns_knot_misc#adding_your_own_custom_configuration_file_to_knot |
Been trying to answer a curious question and upskill some too, by browsinghte codebase. It's not easy, that's for sure. But what I can see is that kresd is run as a procd service. Alas the openwrt boot strap and procd are both poorly documented, in bits only with warning even i places. What I can divine is kresd is loaded with a start_service call which invokes run_instance:
But that's where docs and ability to test ona live syustem fail me. I may soon have my old omni reflashed and ready forrunning offline tests. Stlll in the mean time, what I couldn't find out here is when kresd is actuallyrun and trying to answer for myself the curious question: Is I had hoped to be able to answer that myself but have thus far failed. The procd function schema is a little convoluted and even then I can't find clearly where it acts on the command param that was set. My inference is that run_instance does no such thing and that the role of start_service is to define the parameters that allow procd to actually start the service. Or possibly even that procd_close_instance is responsible for closing off the defintion and asking procd to start the service because there's a line imemdiately thereafter that assumes it's up and waits 2 mins to be sure of it. In which case Not obvious from a codebase search: https://github.com/search?q=repo%3ACZ-NIC%2Fknot-resolver%20kresd.conf&type=code Could be a Turris customisation, not also not obviously: https://github.com/search?q=org%3Aturris-cz+%2Ftmp%2Fkresd.conf&type=code Thanks enormously BTW for the help. And yes, I have since learned more about IPv6 and was misled. They just happen to be terse, because of long 0 strings in the expanded address, but they resolve with whois quite well. |
I believe the init script produces the config file ( |
I know that I can talk to kresd on a tty. In fact use a small script to do just that:
and I can type lua at the prompt. But it's hard to work out what lua. A simple example is using a discovered tty:
But what can I send to kresd to answer the question "What are your configured upstream servers?"
I see a wonderful lua example here that is related (but not the same):
#40 (comment)
But I can't send that to this TTY successfully.
I can save that lua script to reset_forwarders.lua and then:
Clearly something to do with
sandbox.lua
and it not supporting this kind of input (and it seemssandbox.lua
is driving the interaction).Which raises two questions:
How is a lua file like that sent to kresd. The issue cited pipes it to
sudo nc -U /run/knot-resolver/control
but I have kresd on a Turris Omnia (an OpenWRT based router) and we don't havenc
(well there's a BusyBox nc on board but it doesn't do that. We do have socat though)What can I send to it that would reveal the configured upstream servers (or the forwarder configurations)., that kresd is using.
The text was updated successfully, but these errors were encountered: