Bug 275987

Summary: irc/unreal: Update to 6.1.4
Product: Ports & Packages Reporter: tanawts
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: New ---    
Severity: Affects Many People CC: devnull, diizzy
Priority: --- Flags: devnull: maintainer-feedback?
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for updating UnrealIRCD 6.1.4
none
Patch for updating UnrealIRCD 6.1.5
none
Patch for updating UnrealIRCD 6.1.5
none
Patch for updating UnrealIRCD 6.1.5
none
Patch for updating UnrealIRCD 6.1.5 none

Description tanawts 2023-12-28 20:38:32 UTC
Created attachment 247323 [details]
Patch for updating UnrealIRCD 6.1.4

Port Maintainer Update of UnrealIRCD to 6.1.4

Also noting upstream ChangeLog:

UnrealIRCd 6.1.0 through 6.1.3 contain a bug which makes it possible for a websocket user to crash the IRC server. For the issue to trigger you need to have a listen block with websockets enabled.
UnrealIRCd 6.1.4 has been released to fix this issue. 
https://forums.unrealircd.org/viewtopic.php?t=9340
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2024-01-20 16:56:40 UTC
Hi,

Are patches upstreamed and/or merged?

Best regards,
Daniel
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2024-02-18 17:03:39 UTC
Friendly ping
Comment 3 tanawts 2024-02-18 19:52:39 UTC
Sorry for the delay, The patch is to take an upstream update.
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2024-02-25 10:04:02 UTC
Hi,

Needs more work as the build tries to connect during build and then gets stuck.

...
gmake[5]: Leaving directory '/wrkdirs/usr/ports/irc/unreal/work/unrealircd-6.1.4/src/modules/rpc'
cd third; gmake all
gmake[5]: Entering directory '/wrkdirs/usr/ports/irc/unreal/work/unrealircd-6.1.4/src/modules/third'
../../buildmod gmake

Checking for updates for third party modules...
[error] https://modules.unrealircd.org/modules.list: Unable to resolve hostname 'modules.unrealircd.org'
....

Please also upstream your patch as it doesnt seem to be in upstreams repo?
https://github.com/unrealircd/unrealircd/blob/unreal60_dev/configure#L8163
Comment 5 tanawts 2024-03-04 16:56:37 UTC
Hello, I just tried a brand new install of FreeBSD 14 with the unmodified patch and I am unable to reproduce your name resolution problem.  I'm happy to troubleshoot further. Is there a DNS related restriction on your build system?

Regarding the question of Upstream, the mods in question are specific for compatibility with FreeBSDs ports... So far as I am aware the line in question is a compatibility difference between pkg-config and FreeBSD's preferred pkgconf.

pkgconf does not like "0~20161029" vs "20161029" as a valid match.

-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0~20161029\""; } >&5

+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 20161029\""; } >&5
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2024-03-08 20:18:39 UTC
Hi,

I'm testing using Poudriere which is used to generate packages.

Best regards,
Daniel
Comment 7 Rafael Grether 2024-05-14 21:08:53 UTC
Hello tanawts,

I did tests with this port.
I'm not a port expert (I'm still learning), but I've been working with UnrealIrcd for a decade.

So I have some considerations.

UnrealIrcd comes with a few shipped libraries. (https://www.unrealircd.org/docs/Libraries_used_by_UnrealIRCd)

Therefore, there is no need to install these libraries if they are missing from the system. In this case, if the system does not have these libraries, UnrealIrcd will build these libraries with the libraries shipped with them (extras/[library].tar.gz)

Only if the host already has these libraries installed will UnrealIrcd consider them instead of its own shipped libraries.

In the past (some decade ago), pcre upstream there was a problem that it wouldn't compile with unrealircd. But pcre shipped with unrealircd worked.

So I consider its fair to use and compile the libraries shipped with unrealircd instead of installing these libraries as port dependencies in LIB_DEPENDS.
UnrealIrcd constantly updates these shipped libraries. The upstream (SyzOp) is very security conscious and keep these libraries updated, tested and functional.

BTW, 
I can't got the error indicated by commiter, but you can check my poudriere logs for testport: https://poudriere.apt322.org:444/build.html?mastername=jpoudriere-development&build=2024-05-14_19h30m29s

Best Regards,
Rafael Grether
Comment 8 tanawts 2024-05-14 23:59:18 UTC
Hi Rafael, 
FreeBSD expects dependencies to be carried in via other "Ports" where their versioning, installation, and updating can be coordinated.

The UnrealIRCD bundled libraries present a challenge to the FreeBSD Ports framework in that the libraries are compiled and attempted to be installed directly into system directories as dependencies during the compilation process during "./configure" and not created in a staging directory for installation during "make install".

This behavior presents a particularly challenging workflow in that the ports system is expecting all installation of files to take place during the "make install" where the package plist can account for inventory, so there would effectively be no way to make a 'binary package' for FreeBSD.

From a strict security perspective, slipping files into system directories during the ./configure process opens an opportunity for untrusted code/content to piggy back into these directories as well. -- This behavior is a curious one and is /not/ what I would consider a security conscious workflow even in Linux systems that UnrealIRCD is optimized for; I have been tempted to file an upstream bug to Syzop to address this behavior with a more appropriate "make install" driven process.
Comment 9 tanawts 2024-05-15 00:54:36 UTC
Created attachment 250663 [details]
Patch for updating UnrealIRCD 6.1.5

Updates UnrealIRCD to 6.1.5
Comment 10 tanawts 2024-05-15 00:55:21 UTC
Daniel, please try to build the newest patch as it now bumps to 6.1.5.
Comment 11 Rafael Grether 2024-05-15 02:42:39 UTC
Hi tanawts,

Yes, I understood the challenge. Last year I was planning to create this port, but facing some "complicated problems" you mentioned, I ended up leaving it aside.
So I just have to congratulate you for doing it.

However, as I told you, I'm not an experienced porter, so I don't think I'll be of much help.

But whatever I can be of help with, let me know.
Comment 12 Daniel Engberg freebsd_committer freebsd_triage 2024-06-06 11:01:10 UTC
Same issue as before, gets stuck here

Checking for updates for third party modules...
[error] https://modules.unrealircd.org/modules.list: Unable to resolve hostname 'modules.unrealircd.org'

Please start using Poudriere
Comment 13 tanawts 2024-06-06 21:20:19 UTC
Created attachment 251257 [details]
Patch for updating UnrealIRCD 6.1.5
Comment 14 tanawts 2024-06-06 21:27:04 UTC
Thanks Daniel, finally found the issue.

The previous version appears to have always been given a "Fatal error" message but failed to actually break the build, the newer version properly broke the build when trying to use the custom built binary to check for third party sources.

As this methodology runs completely counter to FreeBSD's port system, I've commented out the build test to attempt to fetch external third party modules, as these should come from the Ports Tree or be managed manually by the user after base installation.

Newest Patch tests clean in Poudriere 

Thanks again!
Comment 15 Rafael Grether 2024-06-07 03:47:08 UTC
@tanawts

You commented the line
# https://modules.unrealircd.org/modules.list

But it is not the solution, this line is necessary. Please rollback to the previous patch.

@Daniel Engberg

The error "https://modules.unrealircd.org/modules.list: Unable to resolve hostname" is a poudriere security restriction, that prohibit use network during a poudriere build.
Please set:

RESTRICT_NETWORKING=no

in your poudriere.conf, and this error will be solved.
Comment 16 tanawts 2024-06-07 14:19:00 UTC
Thanks @Rafael Grether, I knew the behavior was due to a security control but wasn't sure if there was a hard requirement to mute ports that attempt network calls during the build process.

Is there a bugzilla method for rolling back a patch or do I need to just resubmit the prior patch and stomp on the current one? I couldn't find an option to rollback via my perms in the portal.

Thanks again!
Comment 17 Rafael Grether 2024-06-07 14:43:49 UTC
@tanawts

Welcome!
In Poudriere, this can be done generically via "RESTRICT_NETWORKING=no" or by selecting specific ports to make use of network resources via "ALLOW_NETWORKING_PACKAGES=something".

About bugzilla patch, sorry, I think is not possible to rollback.

As addition, at the end of the poudriere build, I got some errors.
I think theese .so libs need to be included on pkg-plist:

====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: lib/unreal/central-api.so
Error: Orphaned: lib/unreal/central-blocklist.so
Error: Orphaned: lib/unreal/crule.so
Error: Orphaned: lib/unreal/spamreport.so
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
***Error code 1

If you want to generate a patch by returning the change to the last commented line and adding these libs to pkg-plist, I can test compiling the port in Poudriere.
Comment 18 tanawts 2024-06-07 15:36:13 UTC
Created attachment 251271 [details]
Patch for updating UnrealIRCD 6.1.5

Adds missing plist files as noted by Rafael Grether:
lib/unreal/central-api.so
lib/unreal/central-blocklist.so
lib/unreal/crule.so
lib/unreal/spamreport.so
Comment 19 Rafael Grether 2024-06-07 16:56:23 UTC
Tanawts

I don't know why the poudriere didn't report it earlier (maybe limit buffer?), but poudriere return more 2 missing plist files, that need to be added on pkg-plist file:

====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%ETCDIR%%/examples/example.pt.conf
Error: Orphaned: lib/unreal/no-implicit-names.so
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1
Comment 20 tanawts 2024-06-07 23:56:31 UTC
Created attachment 251277 [details]
Patch for updating UnrealIRCD 6.1.5

Final adjustments to correct missing plist files
Comment 21 Rafael Grether 2024-06-08 02:16:09 UTC
Thanks Tanawts

Poudriere tests passed. UnrealIRCd was builded successfully now.

Poudriere logs:

https://poudriere.apt322.org:444/data/jpoudriere-development/2024-06-08_01h50m01s/logs/unreal-6.1.5.log

Thanks!
Comment 22 Daniel Engberg freebsd_committer freebsd_triage 2024-06-08 18:15:22 UTC
No network access except for "fetch" stage is a hard requirement