Page MenuHomeFreeBSD

dns/p5-Zonemaster-*: new port add Backend, CLI, & Engine
ClosedPublic

Authored by dch on Dec 29 2024, 3:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 6, 4:33 PM
Unknown Object (File)
Fri, Jan 31, 9:26 PM
Unknown Object (File)
Mon, Jan 27, 3:15 PM
Unknown Object (File)
Mon, Jan 27, 2:11 PM
Unknown Object (File)
Sat, Jan 11, 2:15 AM
Unknown Object (File)
Thu, Jan 9, 6:24 AM
Unknown Object (File)
Jan 7 2025, 10:01 AM
Unknown Object (File)
Jan 6 2025, 2:22 PM
Subscribers
None

Details

Summary

See https://doc.zonemaster.net/latest for more details

Sponsored by: SkunkWerks, GmbH

Test Plan

how to test

tests may not work behind residential / dynamic IP ranges,
and also expects IPv4 & IPv6 connectivity

  • install packages (auto set up of zonemaster user and dirs in /usr/local/etc/zonemaster/*.ini )
  • initialise the SQLite DB in /var/db/zonemaster
# pkg install dns/p5-Zonemaster-CLI dns/p5-Zonemaster-Engine dns/p5-Zonemaster-LDNS dns/p5-Zonemaster-Backend
# su -m zonemaster -c "`perl -MFile::ShareDir -le 'print File::ShareDir::dist_dir(qw(Zonemaster-Backend))'`/create_db.pl"

# service zm_rpcapi onestart
# service zm_testagent onestart
# sockstat -46lp 5000
USER     COMMAND    PID   FD  PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
zonemaster perl     39347 6   tcp4   127.0.0.1:5000        *:*
zonemaster perl     25563 6   tcp4   127.0.0.1:5000        *:*
zonemaster perl     14234 6   tcp4   127.0.0.1:5000        *:*
zonemaster perl        46 6   tcp4   127.0.0.1:5000        *:*
zonemaster perl     63611 6   tcp4   127.0.0.1:5000        *:*
zonemaster perl     11923 6   tcp4   127.0.0.1:5000        *:*
$ zmtest zonemaster.net
testid: d8204740e44caac7
100% done
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "created_at": "2024-12-29T15:05:54Z",
    "hash_id": "d8204740e44caac7",
    "params": {
      "domain": "zonemaster.net",
      "ds_info": [],
      "ipv4": true,
      "ipv6": true,
      "nameservers": [],
      "priority": 10,
      "profile": "default",
      "queue": 0
    },
    "results": [
      {
        "level": "INFO",
        "message": "Using version v7.0.0 of the Zonemaster engine.\n",
        "module": "System",
        "testcase": "Unspecified"
      },
      {
        "level": "INFO",
        "message": "The parent zone is \"net\" as returned from name servers \"a.gtld-servers.net/192.5.6.30; a.gtld-servers.net/2001:503:a83e::2:30; b.gtld-servers.net/192.33.14.30; b.gtld-servers.net/2001:503:231d::2:30; c.gtld-servers.net/192.26.92.30; c.gtld-servers.net/2001:503:83eb::30; d.gtld-servers.net/192.31.80.30; d.gtld-servers.net/2001:500:856e::30; e.gtld-servers.net/192.12.94.30; e.gtld-servers.net/2001:502:1ca1::30; f.gtld-servers.net/192.35.51.30; f.gtld-servers.net/2001:503:d414::30; g.gtld-servers.net/192.42.93.30; g.gtld-servers.net/2001:503:eea3::30; h.gtld-servers.net/192.54.112.30; h.gtld-servers.net/2001:502:8cc::30; i.gtld-servers.net/192.43.172.30; i.gtld-servers.net/2001:503:39c1::30; j.gtld-servers.net/192.48.79.30; j.gtld-servers.net/2001:502:7094::30; k.gtld-servers.net/192.52.178.30; k.gtld-servers.net/2001:503:d2d::30; l.gtld-servers.net/192.41.162.30; l.gtld-servers.net/2001:500:d937::30; m.gtld-servers.net/192.55.83.30; m.gtld-servers.net/2001:501:b1f9::30\".\n",
        "module": "Basic",
        "testcase": "Basic01"
      },
      {
        "level": "INFO",
        "message": "The zone \"zonemaster.net\" is found.\n",
        "module": "Basic",
        "testcase": "Basic01"
      },
...

Or test the RPC function:

json
$ curl -s --json '{"id":"1","jsonrpc":"2.0","method":"version_info"}' localhost:5000 | jq .
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "zonemaster_ldns": "4.1.0",
    "zonemaster_engine": "v7.0.0",
    "zonemaster_backend": "11.3.0"
  }
}

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dch requested review of this revision.Dec 29 2024, 3:06 PM
dch created this revision.

I don't think this is the correct approach for dns/p5-Zonemaster-Backend port. This port should have flavors; if not at least options to configure DB backends like sqlite, mysql and pgsql. A quick example for flavors might be postfix or freeradius.

The rest looks alright to me.

dns/p5-Zonemaster-Backend/pkg-plist
70

I think somehow this file got reverse sorted.

dns/p5-Zonemaster-CLI/pkg-plist
12

Same as reverse sort.

I don't think this is the correct approach for dns/p5-Zonemaster-Backend port. This port should have flavors; if not at least options to configure DB backends like sqlite, mysql and pgsql. A quick example for flavors might be postfix or freeradius.

The rest looks alright to me.

The DB configurations requires a post-install task that alters the ini file.
Given the very small user base, building flavours seems a bit gratuitous. I
would prefer to commit as-is and work through the alternatives afterwards,
as I will not have time to test the variants for a while.

Is that ok?

dns/p5-Zonemaster-Backend/pkg-plist
70

What's the best way to sort these? I currently use this
on all the ports I maintain, I have no preference either
way. I think all of these can be generated with makeplist,
so I'll do that shortly.

$ env LANG=en_US.UTF-8 sort < pkg-plist > plist
 && mv plist pkg-plist
dns/p5-Zonemaster-CLI/pkg-plist
12

ditto.

In D48245#1100172, @dch wrote:

I don't think this is the correct approach for dns/p5-Zonemaster-Backend port. This port should have flavors; if not at least options to configure DB backends like sqlite, mysql and pgsql. A quick example for flavors might be postfix or freeradius.

The rest looks alright to me.

The DB configurations requires a post-install task that alters the ini file.
Given the very small user base, building flavours seems a bit gratuitous. I
would prefer to commit as-is and work through the alternatives afterwards,
as I will not have time to test the variants for a while.

Is that ok?

Frankly speaking I actually do not use the FreeBSD ports tree at all as I maintain a different ports tree for someone else and I use that so it's not about me. :)

So it really does not matter whether if it's ok with me or not. One thing that I have learned about the FreeBSD community is you have to meet everyone's expectation. I can let you do that does not mean that others will also give you a pass.

dns/p5-Zonemaster-Backend/pkg-plist
70

I think you are doing it wrong. You do not need to use sort at all. Let make makeplist inside an interactive poudriere testport run it's course of path.

dch marked an inline comment as not done.Dec 29 2024, 9:44 PM
dch added inline comments.
dns/p5-Zonemaster-Backend/pkg-plist
70

huh, make makeplist seems to produce the same ordering:

  • @dir first
  • %% .. next
  • bin/... next
  • etc/* finally

The permissions on the dirs are custom.

This is really weird. Can you run the following and see what happens:

poudriere testport -j <JAIL> -p <PORT> -i dns/p5-Zonemaster-CLI
su -l
make makeplist

This should generate a list like the following which is the correct order.

/you/have/to/check/what/makeplist/gives/you
bin/zonemaster-cli
%%SITE_PERL%%/Zonemaster/CLI.pm
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/GNUmakefile
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/da/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/es/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/fi/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/fr/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/nb/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_PERL%%/auto/share/dist/Zonemaster-CLI/locale/sv/LC_MESSAGES/Zonemaster-CLI.mo
%%SITE_ARCH%%/auto/Zonemaster/CLI/.packlist
%%PERL5_MAN1%%/zonemaster-cli.1.gz
%%PERL5_MAN3%%/Zonemaster::CLI.3.gz

If not there is something else going on in your jail.

dch marked an inline comment as done.Dec 29 2024, 10:45 PM

fixed sorting inside a jail. No amount of LC_ALL and related settings makes it work outside. thanks!

In D48245#1100190, @dch wrote:

fixed sorting inside a jail. No amount of LC_ALL and related settings makes it work outside. thanks!

There are actually lot more steps into the sorting mech itself rather than normal sort with any LOCALES either. So far I recall at first we isolate the @keywords and sort them separately; also there is a reverse sort involved if the keyword is @dir. Then expand the variables(%%<VAR>$$) run the sort and then replace the vars again and append the @keywords section.

dch marked 2 inline comments as done.Dec 31 2024, 4:05 PM

thanks Moin for the info on sorting. I'll do this inside a jail in future across my ports. I think we are ready to commit this then?

Oh sorry I wasn't aware that you were actually awaiting for my approval because these are new ports. Feel free to shoot at will.

This revision is now accepted and ready to land.Dec 31 2024, 4:36 PM