Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jul 2022 20:56:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 265255] net-mgmt/unbound_exporter rc.d script causes failure to start when ssl configuration is empty
Message-ID:  <bug-265255-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265255

            Bug ID: 265255
           Summary: net-mgmt/unbound_exporter rc.d script causes failure
                    to start when ssl configuration is empty
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: joel.bohnes+freebsd@gmail.com
                CC: aduitsis@cpan.org
             Flags: maintainer-feedback?(aduitsis@cpan.org)
                CC: aduitsis@cpan.org

In our configuration we have have unbound and unbound_exporter running in t=
he
same jail. The unbound remote-control is listening on a plain (unencrypted)=
 tcp
socket.

Section in unbound.conf looks something like this:
--- unbound.conf ---
remote-control:
        control-enable: yes
        control-interface: 127.0.0.1
        control-use-cert: "no"
---

This configuration is supported by unbound_exporter, but it's a bit awkward
because it requires passing an empty string in the command line. The correc=
t,
working command line looks like this:

  unbound_exporter -unbound.cert "" -unbound.ca "" <...>

If we try to use the rc.d script provided by the unbound_exporter port, we =
can
try using following settings:
--- /etc/rc.conf ---
unbound_exporter_enable=3D"YES"
unbound_exporter_ca=3D""
unbound_exporter_cert=3D""
unbound_exporter_key=3D""
---

However this will fail with the following error:

--- /var/log/unbound_exporter.log ---
time=3D"2022-07-16T22:12:56+02:00" level=3Dinfo msg=3D"Starting unbound_exp=
orter"
source=3D"unbound_exporter.go:478"
panic: open -unbound.cert: no such file or directory

goroutine 1 [running]:
main.main()
        github.com/kumina/unbound_exporter/unbound_exporter.go:481 +0x485
---

The failing command that the init script executes looks like this:
  unbound_exporter -unbound.cert -unbound.ca <...>

When using command_args in the init script, it seems a bit difficult to pass
empty strings
along (which is a feature of shellscript).

We used to following (nasty?) patch to fix the rc.d script.
---
--- /usr/local/etc/rc.d/unbound_exporter.original    2022-07-16
22:12:50.062388470 +0200
+++ /usr/local/etc/rc.d/unbound_exporter      2022-07-16 22:12:09.073708468
+0200
@@ -46,9 +46,9 @@
 command=3D/usr/sbin/daemon
 procname=3D"/usr/local/bin/unbound_exporter"
 command_args=3D"-p ${pidfile} /usr/bin/env ${procname} \
-                               -unbound.ca ${unbound_exporter_ca} \
-                               -unbound.cert ${unbound_exporter_cert} \
-                               -unbound.key ${unbound_exporter_key} \
+                               -unbound.ca '\"'${unbound_exporter_ca}'\"' \
+                               -unbound.cert '\"'${unbound_exporter_cert}'=
\"'
\
+                               -unbound.key '\"'${unbound_exporter_key}'\"=
' \
                                -web.listen-address ${unbound_exporter_bind=
} \
                                 ${unbound_exporter_args} >
${unbound_exporter_log_file} 2>&1"
---

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-265255-7788>