Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 201996 - net-irc/unrealircd server.key.pem symlink and server.cert.key permission problems
Summary: net-irc/unrealircd server.key.pem symlink and server.cert.key permission prob...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Packages in net-irc
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-11 23:20 UTC by Attila Tóth
Modified: 2007-12-12 16:01 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Certification postinstall: corrected location and owner (unrealircd-3.2.7-r1_correct_cert_install.diff,482 bytes, patch)
2007-12-12 13:18 UTC, Attila Tóth
Details | Diff
Proposed change for unrealircd-3.2.7-r1.ebuild (unrealircd-3.2.7-r1.ebuild.diff,716 bytes, patch)
2007-12-12 15:23 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2007-12-11 23:20:57 UTC
net-irc/unrealircd-3.2.7-r1:
Even after running the ebuild's postinst functions, the server fails to start along with the following error messages:
[date and time] - Failed to load SSL private key server.key.pem
or
[date and time] - Failed to load SSL certificate server.cert.pem

The first one is caused by a missing symlink, and the second is because the certificate file is accessible only by root.

Reproducible: Always

Steps to Reproduce:
1. emerge net-irc/unrealircd-3.2.7-r1
2. ebuild ...net-irc/unrealircd-3.2.7-r1.ebuild postinst
3. /etc/init.d/unrealircd start
Comment 1 Stefan Becker 2007-12-12 12:41:43 UTC
Hello,

> Steps to Reproduce:
> 1. emerge net-irc/unrealircd-3.2.7-r1
> 2. ebuild ...net-irc/unrealircd-3.2.7-r1.ebuild postinst
> 3. /etc/init.d/unrealircd start

obiously there is a problem with generating and linking the new certificates/keys in the right place. I think this is strongly related to the change from do_cert to install_cert in the ebuild (btw. shouldn't that be noted in the changelog?).

The second problem is that all files within /etc/unrealircd/ are chowned to unrealircd during pkg_install. But the certificates are now generated during pkg_postinstall and there is no chown there, so the files will still be owned by root after the merge to the live-filesystem is made.

I wrote a patch (3.2.7-r1) for both problems. It testet it on two x86 systems without problems.

PS: I'm sorry to say this but why the hell is such a packet, with an easy to see error is marked stable?!


--------- PATCH -------------
127c127
<                       install_cert /etc/unrealircd/server.cert
---
>                       install_cert ${D}/etc/unrealircd/server.cert
128a129
>                       chown -R unrealircd "${D}"/etc/unrealircd/server.*
Comment 2 Stefan Becker 2007-12-12 12:58:28 UTC
Hi again,

I'm very sorry, but I made a mistake in the previous patch. I'm not that expirienced with the portage system and overlooked that postinst is executed _after_ the merge.

So I have to reformulate my statement:

The files were created in the right place, but not with the right owner and the symlink wasn't placed in /etc/unrealircd but in the builddirectory.

I think this happend due to the fact that dosym handles $D transparently. I'm not sure if dosym can be used for this purpose, so I circumvented the use of it. 

Here is another patch (to the orignial 3.2.7-r1 file. Sorry for the inconvenience.

----------- PATCH ---------------
128c128,129
<                       dosym server.cert.key /etc/unrealircd/server.key.pem
---
>                       ln -s /etc/unrealircd/server.cert.key /etc/unrealircd/server.key.pem
>                       chown -R unrealircd /etc/unrealircd/server.*
Comment 3 Attila Tóth 2007-12-12 13:12:54 UTC
(In reply to comment #1)
> Hello,
> 
> > Steps to Reproduce:
> > 1. emerge net-irc/unrealircd-3.2.7-r1
> > 2. ebuild ...net-irc/unrealircd-3.2.7-r1.ebuild postinst
> > 3. /etc/init.d/unrealircd start
> 
> obiously there is a problem with generating and linking the new
> certificates/keys in the right place. I think this is strongly related to the
> change from do_cert to install_cert in the ebuild (btw. shouldn't that be noted
> in the changelog?).
> 
> The second problem is that all files within /etc/unrealircd/ are chowned to
> unrealircd during pkg_install. But the certificates are now generated during
> pkg_postinstall and there is no chown there, so the files will still be owned
> by root after the merge to the live-filesystem is made.
> 
> I wrote a patch (3.2.7-r1) for both problems. It testet it on two x86 systems
> without problems.
> 
> PS: I'm sorry to say this but why the hell is such a packet, with an easy to
> see error is marked stable?!
> 
> 
> --------- PATCH -------------
> 127c127
> <                       install_cert /etc/unrealircd/server.cert
> ---
> >                       install_cert ${D}/etc/unrealircd/server.cert
> 128a129
> >                       chown -R unrealircd "${D}"/etc/unrealircd/server.*
> 

This symptom has popped up probably because they simply moved this part of the ebuild in the postinstall section...
Comment 4 Attila Tóth 2007-12-12 13:18:26 UTC
Created attachment 138309 [details, diff]
Certification postinstall: corrected location and owner

Proposed modification of the ebuild.
Comment 5 Attila Tóth 2007-12-12 13:19:58 UTC
I've created a diff of these changes. Thank you for your contribution. I hope, the maintainer will include this soon and push it alive.

Regards,
Dw.

(In reply to comment #2)
> Hi again,
> 
> I'm very sorry, but I made a mistake in the previous patch. I'm not that
> expirienced with the portage system and overlooked that postinst is executed
> _after_ the merge.
> 
> So I have to reformulate my statement:
> 
> The files were created in the right place, but not with the right owner and the
> symlink wasn't placed in /etc/unrealircd but in the builddirectory.
> 
> I think this happend due to the fact that dosym handles $D transparently. I'm
> not sure if dosym can be used for this purpose, so I circumvented the use of
> it. 
> 
> Here is another patch (to the orignial 3.2.7-r1 file. Sorry for the
> inconvenience.
> 
> ----------- PATCH ---------------
> 128c128,129
> <                       dosym server.cert.key /etc/unrealircd/server.key.pem
> ---
> >                       ln -s /etc/unrealircd/server.cert.key /etc/unrealircd/server.key.pem
> >                       chown -R unrealircd /etc/unrealircd/server.*
> 

Comment 6 Ulrich Müller gentoo-dev 2007-12-12 15:23:04 UTC
Created attachment 138315 [details, diff]
Proposed change for unrealircd-3.2.7-r1.ebuild

This takes care of ${ROOT} for the symlink destination.

@net-irc: Do you mind if I commit this myself?
Comment 7 Ulrich Müller gentoo-dev 2007-12-12 15:58:36 UTC
Fixed and revbumped to -r2, as discussed on IRC with cla.