I am writing a windows service in python and I am using the keyring module to securely store credentials that I need to use regularly and persistently. This means that keyring stores passwords using the user credentials of the local system.
All I do is use the two main keyring functions: get_password(SERVICE_NAME, username, password)and
set_password(SERVICE_NAME, username). I did not pre-configure keyring, as I understood it, and saw that it automatically configures its backend.
When I run this on Windows Server 2008 and above, everything runs smoothly. But when I run this on Windows Server 2003, I get this nasty error:
error: (1312, 'CredWrite', 'A specified logon session does not exist. It may already have been terminated.')
I suppose this has something to do with the login session of the local user of the system, which is used to start my service, although this is typical, as I understood it as a form of super-administrator-superuser, which must have permissions to do anything in system. But when I change the user login credentials to the local administrator, everything works smoothly.
Is there anything I need to change in my service setup for this to work? Or change user security policies of the local system? Or should I ask users to start this service with the local administrator credentials?
source
share