Bug 239819

Summary: [PATCH] net-mgmt/metronome: add rc script
Product: Ports & Packages Reporter: Leo Vandewoestijne <freebsd>
Component: Individual Port(s)Assignee: Kirill Ponomarev <krion>
Status: Closed FIXED    
Severity: Affects Only Me CC: freebsd, tremere
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (krion)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
metronome add rc script
none
metronome rc script
none
Add rc.d script, set localhost as default, drop privileges tremere: maintainer-approval?

Description Leo Vandewoestijne 2019-08-13 15:33:24 UTC
Created attachment 206487 [details]
metronome add rc script

Dear maintainer,

By these a patch that adds a rc script to the metronome port.
I've tested it, insofar; I currently run this myself now / and it does what I want.
I think it allows for improvement; for example running the daemon as root might be undesired.

Could you please review what I've done?

Leo.
Comment 1 Leo Vandewoestijne 2019-08-13 15:39:22 UTC
Oh, I just notice too late I copy/pasted 10 lines too much at the top of the patch.
Comment 2 Leo Vandewoestijne 2019-10-28 09:02:20 UTC
Created attachment 208649 [details]
metronome rc script

Same but without the part that was copy/pasted too much.

Can you please apply this, such that my daemons will start?
Comment 3 Kirill Ponomarev freebsd_committer freebsd_triage 2019-10-28 10:20:09 UTC
Why are you using IPv6 only?
Comment 4 Leo Vandewoestijne 2019-10-28 14:30:57 UTC
Because the manual says that "::" is the default
https://github.com/ahupowerdns/metronome/
Comment 5 Kirill Ponomarev freebsd_committer freebsd_triage 2019-10-28 18:48:47 UTC
Leo, could you please elaborate? I don't think we can merely rely on IPv6 in this case.
Comment 6 Leo Vandewoestijne 2019-10-29 12:44:35 UTC
I've double checked, if I don't use those two rc.conf switches, meaning do use the default, thus [::]:2003 and [::]:8000, then it's listening on all IP's, including IPv4.
So with this option you can limit it to a single IP, which I think is more desired.
Comment 7 Leo Vandewoestijne 2019-10-29 12:52:27 UTC
Correction;
when testing I used a wrong command from history, and mistake that the daemon restarted. So above conclusion is wrong.

I did it over again AND used nmap to see the result.
In deed it's v6 only.
But anyway, I think it better had a value (the default of the vendor) than have no value.
It also could be "127.0.0.1:port", but I don't see much benefit in using that.
Comment 8 Kirill Ponomarev freebsd_committer freebsd_triage 2019-10-29 14:58:48 UTC
Leo, I would definitely I accept this rc script if it would work on non-IPv6 systems as well. There are a lot of installations with disabled IPv6 interfaces so this rc won't run on them. Is it possible to change it, could you ping upstream to get to know it?
Comment 9 Leo Vandewoestijne 2019-10-29 15:29:26 UTC
upstream has likely other priorities.
But was the suggested 127.0.0.1 no option as placeholder?
Comment 10 Kirill Ponomarev freebsd_committer freebsd_triage 2019-10-29 17:46:10 UTC
127.0.0.1 would work by accessing it from localhost, but what about IPv4 and accessing it from the network?
Comment 11 Leo Vandewoestijne 2019-12-09 11:05:59 UTC
In that case user can define, which in such case (IPv4-only) will be a nessesity anyway.
Comment 12 Leo Vandewoestijne 2020-07-30 13:44:21 UTC
This is open since a while. Let's make resume of evens:

[suggestion]: RC script, having exact the same defaults equal to what the vendor's already had.

[response]: It's IPv6 / would accept if it's IPv4

[problem]: which IPv4 address should -or could...- be default?

[suggestion to the "problem"]: 127.0.0.1

[question]: but what about IPv4 and accessing it from the network?


Well, if you wish to have it act different, than you have to configure it to act different. This simply would be the case anyway if you wanted it to start.
And that's where the rc.conf switches are meant for; if they would not be there, then it would take the default, which didn't work anyway (in case of your scenario).
So I think a real solution to a hypothetical problem is already included.

However if you insist on listening on a specific IPv4 address, then which one you deem more appropriate as default than 127.0.0.1?
IMHO I/you/we cannot brutally detect something random and select that, it's up to the administrator, I think.

If you don't have a better solution or workaround, then I think having no rc script at all is a bit cruel to users capable of defining a listening address and the desire start the daemon.
Comment 13 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:59 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 14 Leo Vandewoestijne 2022-10-26 13:14:22 UTC
Haven't looked at this port since a while, and I remember setting it up from zero wasn't the easiest.

Paraphrasing summary of above dialog:

> would accept if would work on v4 out of the box
< default is all v6,
  can't have it undefined,
  don't know users IPv4 addres,
  so only -somwhat- working alternative would be 127.0.0.1

(so don't know how to continue)
Comment 15 Ralf van der Enden 2024-05-17 07:14:16 UTC
Created attachment 250715 [details]
Add rc.d script, set localhost as default, drop privileges

My take on the rc.d script:

- The patch contains a UID and GID for user _metronome (345)
- The rc.d script sets the webserver and carbon address to localhost instead of [::]. They can be modified via variables in rc.conf
- I set the stats directory to /var/db/metronome (installation should set the correct chown on the dir)

And I bump the PORTREVISION so whomever uses this will get the rc.d script
Comment 16 commit-hook freebsd_committer freebsd_triage 2024-05-18 05:19:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9ae1e22950e7c9114e6d0946855de4f6992ac3b4

commit 9ae1e22950e7c9114e6d0946855de4f6992ac3b4
Author:     Kirill Ponomarev <krion@FreeBSD.org>
AuthorDate: 2024-05-18 05:15:28 +0000
Commit:     Kirill Ponomarev <krion@FreeBSD.org>
CommitDate: 2024-05-18 05:17:59 +0000

    net-mgmt/metronome: Add rc.d script

    PR:             239819
    Reported by:    freebsd_at_dns_d_company, tremere_at_cainites_d_net

 GIDs                                        |  2 +-
 UIDs                                        |  2 +-
 net-mgmt/metronome/Makefile                 | 18 +++++++++++++--
 net-mgmt/metronome/files/metronome.in (new) | 35 +++++++++++++++++++++++++++++
 net-mgmt/metronome/pkg-plist                |  1 +
 5 files changed, 54 insertions(+), 4 deletions(-)