Univention Bugzilla – Bug 55750
Running `univention-app list` as Administrator throws traceback for `/etc/machine.secret`
Last modified: 2023-02-23 14:02:28 CET
## Description When using the `univention-app` command, running as an Administrator user, I get the following traceback if I run `univention-app list` without sudo: ``` [Errno 13] Keine Berechtigung: '/etc/machine.secret' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/univention/appcenter/actions/__init__.py", line 194, in call_with_namespace result = self.main(namespace) File "/usr/lib/python3/dist-packages/univention/appcenter/actions/list_apps.py", line 64, in main for app, versions, installations in self._list(args.app): File "/usr/lib/python3/dist-packages/univention/appcenter/actions/list_apps.py", line 136, in _list lo, pos = get_machine_connection() File "/usr/lib/python3/dist-packages/univention/appcenter/udm.py", line 144, in get_machine_connection return getMachineConnection() File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 178, in getMachineConnection lo = univention.uldap.getMachineConnection(start_tls, decode_ignorelist=decode_ignorelist, ldap_master=ldap_master) File "/usr/lib/python3/dist-packages/univention/uldap.py", line 172, in getMachineConnection bindpw = open(secret_file).read().rstrip('\n') PermissionError: [Errno 13] Keine Berechtigung: '/etc/machine.secret' Traceback (most recent call last): File "/usr/bin/univention-app", line 101, in <module> main() File "/usr/bin/univention-app", line 88, in main ret = action(args) File "/usr/lib/python3/dist-packages/univention/appcenter/actions/__init__.py", line 194, in call_with_namespace result = self.main(namespace) File "/usr/lib/python3/dist-packages/univention/appcenter/actions/list_apps.py", line 64, in main for app, versions, installations in self._list(args.app): File "/usr/lib/python3/dist-packages/univention/appcenter/actions/list_apps.py", line 136, in _list lo, pos = get_machine_connection() File "/usr/lib/python3/dist-packages/univention/appcenter/udm.py", line 144, in get_machine_connection return getMachineConnection() File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 178, in getMachineConnection lo = univention.uldap.getMachineConnection(start_tls, decode_ignorelist=decode_ignorelist, ldap_master=ldap_master) File "/usr/lib/python3/dist-packages/univention/uldap.py", line 172, in getMachineConnection bindpw = open(secret_file).read().rstrip('\n') PermissionError: [Errno 13] Keine Berechtigung: '/etc/machine.secret' ``` ## Expected Behavior When running a command that does not have the appropriate permissions, it would be useful to get a helpful message (e.g., "Insufficient permissions. Please run this command as root") instead of a traceback. The traceback makes the user believe that something is broken, instead of switching to sudo. ## How to Reproduce * SSH into a UCS machine as Administrator. * Run `univention-app list`. * Traceback appears. NOTE: the UCS machine has both UCS@school and the Kelvin API installed, if that makes a difference.