Bug 46052 - univention-management-console-web-server fails during setup after update to 4.3
univention-management-console-web-server fails during setup after update to 4.3
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: System setup
UCS 4.3
Other Linux
: P5 normal (vote)
: UCS 4.3
Assigned To: Felix Botner
Erik Damrose
: interim-2
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-16 10:48 CET by Felix Botner
Modified: 2018-03-14 14:38 CET (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Erik Damrose univentionstaff 2018-01-16 11:01:47 CET
We found that the certificate creation in system-setup failed:

[master234] 2018-01-15T20:16:40.434399	Running hooks in /etc/ca-certificates/update.d...
[master234] 2018-01-15T20:16:40.445909	done.
[master234]	Getting request Private Key
[master234]	Generating certificate request
[master234]	Using configuration from /etc/univention/ssl/openssl.cnf
[master234]	Can't open /etc/univention/ssl/ucsCA/index.txt.attr for reading, No such file or directory
[master234]	139768205571328:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:74:fopen('/etc/univention/ssl/ucsCA/index.txt.attr','r')
[master234]	139768205571328:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:81:

Thus, no valid certificates are created, the error is not caught, and the resulting apache2 config is invalid
Comment 2 Felix Botner univentionstaff 2018-01-16 13:23:12 CET
the problem is 

 certificate="$(mktemp)"
        key="$(mktemp)"
        ca="$(mktemp)"
        cp "/etc/univention/ssl/$(ucr get hostname).$(ucr get domainname)/cert.pem" "$certificate"
        cp "/etc/univention/ssl/$(ucr get hostname).$(ucr get domainname)/private.key" "$key"
        cp "/etc/univention/ssl/ucsCA/CAcert.pem" "$ca"
        ucr set \
                apache2/ssl/certificate="$certificate" \
                apache2/ssl/key="$key" \
                apache2/ssl/ca="$ca"


apache no longer accepts cert files under /tmp and refuses to start

Jan 16 07:16:06 unassigned-hostname systemd[1]: Starting The Apache HTTP Server...
Jan 16 07:16:06 unassigned-hostname apachectl[25249]: AH00526: Syntax error on line 24 of /etc/apache2/sites-enabled/default-ssl.conf:
Jan 16 07:16:06 unassigned-hostname apachectl[25249]: SSLCACertificateFile: file '/tmp/tmp.4NrtFzN8xh' does not exist or is empty
Jan 16 07:16:06 unassigned-hostname apachectl[25249]: Action 'start' failed.


so from this point on, apache is not running during the setup until the cert files are replaced again.
Comment 3 Felix Botner univentionstaff 2018-01-16 13:39:06 CET
/var/cache/univention-system-setup/tmp.J2juflxDz6 works, so we have to modify  /usr/lib/univention-system-setup/scripts/setup-join.sh
Comment 4 Felix Botner univentionstaff 2018-01-16 14:17:58 CET
fixed in

Successful build
Package: univention-system-setup
Version: 11.0.2-4A~4.3.0.201801161342
Branch: ucs_4.3-0
Comment 5 Philipp Hahn univentionstaff 2018-01-17 13:59:21 CET
(In reply to Felix Botner from comment #2)
> the problem is 
> 
>  certificate="$(mktemp)"
>         key="$(mktemp)"
>         ca="$(mktemp)"
>         cp "/etc/univention/ssl/$(ucr get hostname).$(ucr get
> domainname)/cert.pem" "$certificate"
>         cp "/etc/univention/ssl/$(ucr get hostname).$(ucr get
> domainname)/private.key" "$key"
>         cp "/etc/univention/ssl/ucsCA/CAcert.pem" "$ca"
>         ucr set \
>                 apache2/ssl/certificate="$certificate" \
>                 apache2/ssl/key="$key" \
>                 apache2/ssl/ca="$ca"
> 
> 
> apache no longer accepts cert files under /tmp and refuses to start

The real cause is this:
# systemctl cat apache2.service
# /lib/systemd/system/apache2.service
...
>[Service]
>PrivateTmp=true

# man 5 systemd.exec
>PrivateTmp=
>  Takes a boolean argument. If true, sets up a new file system namespace for the executed processes and mounts private /tmp and /var/tmp directories inside it that is not shared by processes outside of the namespace.

This is also responsible for Bug #46004
Comment 6 Erik Damrose univentionstaff 2018-02-13 12:18:09 CET
OK: use mktemp with /var/cache/univention-system-setup as basedir
Reopen: no changelog entry
Comment 7 Felix Botner univentionstaff 2018-02-16 10:26:22 CET
done
Comment 8 Erik Damrose univentionstaff 2018-02-16 10:32:53 CET
Great, thanks. I renamed apache to apache2

Verified
Comment 9 Stefan Gohmann univentionstaff 2018-03-14 14:38:13 CET
UCS 4.3 has been released:
 https://docs.software-univention.de/release-notes-4.3-0-en.html
 https://docs.software-univention.de/release-notes-4.3-0-de.html

If this error occurs again, please use "Clone This Bug".