Management Console Login fails due to Leap Year

Hello,
At the moment it is possible that the login to the Management Console fails without an error message or with a misleading error. In the Console Log there appears the following Traceback:

29.02.16 00:42:31.533 MAIN ( PROCESS ) : SessionClient(0x4478f50): _authenticated: success=True status=200 message=None 29.02.16 00:42:31.534 MAIN ( ERROR ) : Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __call__ return self.callable(*self.args, **self.kwargs) File "/usr/sbin/univention-management-console-web-server", line 1010, in default return self._auth_request(req, sessionid) File "/usr/sbin/univention-management-console-web-server", line 1035, in _auth_request self.set_session(sessionid, username) File "/usr/sbin/univention-management-console-web-server", line 699, in set_session self.set_cookies(('UMCSessionId', sessionid), ('UMCUsername', username)) File "/usr/sbin/univention-management-console-web-server", line 678, in set_cookies expires = expires.replace(year=expires.year + 5) ValueError: day is out of range for month

This Problem is due to a leap year and can be fixed by using the following commands:

sed -i 's|expiration.year + 5)|expiration.year + 4)|' /usr/sbin/univention-management-console-web-server sed -i 's|expires.year + 5)|expires.year + 4)|' /usr/sbin/univention-management-console-web-server /etc/init.d/univention-management-console-web-server restart

Additionally, we will provide an Erratum today, that will fix this behaviour.

Kind Regards,
Jens Thorp-Hansen

UCS 4.1 installation using the ISO seems to be impossible. The UMC domain setup wizard that follows after the packages installation is stuck and returns error message:

If I press Alt+F4 I get terminal (unassigned-hostname login) where I can login only as root, not as Administrator. If I run

sed -i 's|expires.year + 5)|expires.year + 4)|' /usr/sbin/univention-management-console-web-server[/code] and [code]/etc/init.d/univention-management-console-web-server restart

I receive error message:

[info] Restarting Univention Management Console Web Server. File "/usr/sbin/univention-management-console-web-server", line 679 cookie = cherrypy.response.cookie ^ SyntaxError: invalid syntax done.

Also connection through SSH returns

Reboot didn’t help. What would you recommend to do to fix it?

It looks like something went wrong with the sed command. Maybe you missed the ) at the end?

Can you post the output of the following command?

grep -A 2 -B 2 "cookie =" /usr/sbin/univention-management-console-web-server

I’ve just tested it. For me it worked in the following way:
[ul]
[li] Starting the installation via ISO image[/li]
[li] When the UMC error message is shown, I pressed --F3 and typed the following commands

chroot /target bash sed -i 's|expires.year + 5)|expires.year + 4)|' /usr/sbin/univention-management-console-web-server /etc/init.d/univention-management-console-web-server restart [/li]
[li] Switch back with -F5[/li]
[li] Reload UMC with F5[/li]
[li] Run the setup wizard and select “update system after setup” at the end of the installation which is pre-selected[/li][/ul]

Afterwards, I was able to reboot UCS and I could login into UMC. Sorry, for this really complicated way.

Tomorrow, it will work out-of-the-box again.

I’ve double checked this and you are absolutely right. I fixed the typo by running

sed -i 's|expires.year + 4|expires.year + 4)|' /usr/sbin/univention-management-console-web-server

and

/etc/init.d/univention-management-console-web-server restart

Then rebooted and the domain setup wizard opened.

[quote=“Gohmann”]Can you post the output of the following command?

grep -A 2 -B 2 "cookie =" /usr/sbin/univention-management-console-web-server

[code]root@unassigned-hostname:~# grep -A 2 -B 2 “cookie =” /usr/sbin/univention-management-console-web-server
expires = datetime.datetime.now()
expires = expires.replace(year=expires.year + 4
cookie = cherrypy.response.cookie
for name, value in cookies:
name = self.suffixed_cookie_name(name)
__

    def get_cookie(self, name):
            cookie = cherrypy.request.cookie.get
            morsel = cookie(self.suffixed_cookie_name(name)) or cookie(name)
            if morsel:[/code]

Thank you Stefan for the command to troubleshoot the issue. The line expires = expires.replace(year=expires.year + 4 has now the missing ). :slight_smile:

Mastodon