-
Notifications
You must be signed in to change notification settings - Fork 12
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
Issues on OpenWRT 22.03.4 #21
Comments
Hi, thanks for sending the report. I invite @LLdaniel to chime in, if they want, as I have no prior experience with OpenWrt packaging and services.
The permissions should be as restrictive as possible. To me it looks like the process should be started as a user like
The Example: The infix configuration file parameter might not be the most fortunate, or intuitive way to use multiple files, but if it's changed now, it would break existing behaviour. |
Hi, thanks for the report! I will try to address your points and have to admit that I tested it for OpenWrt version 23.05 (At the moment I suspect no difference for 22.03 and 23.05 regarding hetzner_ddns). Just for me as a question: Did you install the
I tried to follow closely the OpenWrt doc and tried to use the a non-root user. See: hetzner_ddns/hetzner_ddns.openwrt.rc Line 21 in ce69db6
Maybe we can change the default permissions for the config file as you already suggested. Or as @filiparag suggested: Switch to the daemon user:
# my available openwrt users (without creating one manually)
# cat /etc/passwd
root:x:0:0:root:/root:/bin/ash
daemon:*:1:1:daemon:/var:/bin/false
ftp:*:55:55:ftp:/home/ftp:/bin/false
network:*:101:101:network:/var:/bin/false
nobody:*:65534:65534:nobody:/var:/bin/false
ntp:x:123:123:ntp:/var/run/ntp:/bin/false
dnsmasq:x:453:453:dnsmasq:/var/run/dnsmasq:/bin/false
logd:x:514:514:logd:/var/run/logd:/bin/false
ubus:x:81:81:ubus:/var/run/ubus:/bin/false
same answer like for 1.
Seems I overlooked that, probably you are referring to this line: hetzner_ddns/hetzner_ddns.openwrt.rc Line 9 in ce69db6
Thanks @filiparag explanation. First I wondered where the intermediate part of the path comes from: |
Hi, thanks for your quick replies.
After installation on my OpenWRT, these files belong to root:root. The /var/run and /var/log folders also with do755, hence only root is permitted to add files here.
Thanks for your explanation @filiparag . I totally agree.
I installed the .ipkg by downloading it from the github release and installing it via LuCI. Afterwards I added my token to the /etc/config config file and adjusted the domain / zone. Unfortunately, due to the permissions of the directory, changing to daemon doesn't work either. # service hetzner_ddns stop
# service hetzner_ddns start
# service hetzner_ddns info
{
"hetzner_ddns": {
"instances": {
"[hetzner_ddns]": {
"running": false,
"command": [
"/usr/bin/hetzner_ddns",
"-d"
],
"term_timeout": 5,
"exit_code": 2,
"limits": {
"core": "0"
},
"respawn": {
"threshold": 3600,
"timeout": 5,
"retry": 5
},
"pidfile": "/var/run/hetzner_ddns.pid",
"user": "daemon"
}
}
}
}
But it starts as root # service hetzner_ddns stop
# service hetzner_ddns start
# service hetzner_ddns info
{
"hetzner_ddns": {
"instances": {
"[hetzner_ddns]": {
"running": false,
"command": [
"/usr/bin/hetzner_ddns",
"-d"
],
"term_timeout": 5,
"exit_code": 0,
"limits": {
"core": "0"
},
"respawn": {
"threshold": 3600,
"timeout": 5,
"retry": 5
},
"pidfile": "/var/run/hetzner_ddns.pid",
"user": "root"
}
}
}
} This is something I don't like either. @LLdaniel Let me dig into some documentation, maybe I'll find a solution here as well |
Maybe we can do it similar to bind: |
Fixes Issue 3 in filiparag#21
Removes Number 2 in filiparag#21
Remove .sh suffix Helps on filiparag#21
On the other hand: All data is present to add this to a ddns-scripts add-in, but this would include major refactorings |
I am not against supporting OpenWrt's universal format as long as adding it doesn't spill over to issues on other target platforms. What do you think about adding an intermediate service script that parses, translates ddns-scripts format to configuration format this script understands, and then runs it as a child? |
Yeah, but as far as I've seen it, the current functions must be split up into more atomic functions and a library-script that is dot-sourced must be created from it. I'm not sure, if this is wise. |
The hetzner_ddns.sh script is sourcable as-is, if the if [ -z "$HETZNER_DDNS_NOEXEC" ]; then
if [ "$daemon" = '1' ]; then
# Deamonize and write PID to file
if touch "/var/run/$self.pid";
then
run_ddns &
echo $! > "/var/run/$self.pid"
else
>&2 echo 'unable to daemonize'
exit 2
fi
else
# Run in foreground
run_ddns
fi
fi And when sourcing the script we add the HETZNER_DDNS_NOEXEC=1 . /usr/local/bin/hetzner_ddns This is just a quick and dirty modification idea, it should be thought through. As for more granular functions, they are already segmented enough in my opinion; it's just unfortunate that global variables have to be used for storing state. Maybe IPv4/IPv6 functionality can be split further, but it would add a lot of code duplication noise. |
Sorry, that I was a bit quiet about the follow-up discussion, because I have not a really strong feeling to push it into either one or into another direction. So far I had no chance to have a deeper look into the ddns client from openwrt. Hence I cannot say what are the differences and commonalities. |
Hi,
thank you for your tremendous work. This was, what I was looking for.
Thanks to #18 by @LLdaniel I was also able to install it on OpenWrt 22.03.4.
Unfortunately, I found some issues:
/etc/init.d/hetzner_ddns starts process as nobody. After installation, the config file has o600 permissions only
/etc/init.d/hetzner_ddns starts process as nobody. /var/run and /var/log are by default only root-writable
/etc/init.d/hetzner_ddns wants to start /usr/bin/hetzner_ddns, but only /usr/bin/hetzner_ddns.sh exists
After solving all issues above, the following issue remains: The start-up script tries to acquire /var/log/hetzner_ddns./etc/config/hetzner_ddns.conf.log
My current workarounds to this issue:
Step four is something I really did not like. And I think, that 1-3 should be trivial steps I can also provide a fix for.
But I have no idea what goes wrong in 4.
Regards
Carsten
The text was updated successfully, but these errors were encountered: