Skip to content

Instantly share code, notes, and snippets.

@FedericoHeichou
FedericoHeichou / fix-broken-keyring.py
Last active November 16, 2025 20:13
Today I fucked up really hard with pam and the damn gkm changed the keyring password with the same password but adding a "\n" at the end, logging "fixed login keyring password to match login password".
import socket
import os
'''
Today I fucked up really hard with pam and the damn gkm changed the keyring password with the same password but adding a "\n" at the end, logging "fixed login keyring password to match login password".
Obviously at first I tried unlocking it via command line (using gnome-keyring-daemon --unlock) adding the "\n" to the password, but it didn't work.
So I went in a rabbit hole trying to find the correct password.
After some tries I decided to send the raw password (with "\n" at the end) to the socket itself, and it worked.
Now the problem is that I can't type the "\n" in the gnome-keyring prompt, so I had to send the change password operation to the socket as well.
After some tries I managed to change the password back to the original one without the "\n" at the end.
{
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"use": "sig",
"kid": "ecommerce",
"alg": "RS256",
"n": "iZoq6QNybi-e6oyNDlq2UKfgWndqY7xH-ao2fREGd-_UZLIlVouXY5axwRQHqjoimjjXxywiTrusmmSC1XnrcB3q-5tV3RFJnfjLTbr3UlQTZekZokTOg5rLaiXibzHR8vm3IVOaIfn0cK5BYQthtDPRnIzd4-_T8KFncrz1Ts98BI5GdUAb5W-sWz0LD2ijKOtgNb8YXmaq4yogpbZcvCzWGRD3WdNMhK1Pv1I8g6XgVyCKZwgx1-1KNVvod46PPcXJ8CVBZz9CpwgM7Nasmsh94xXKtcxRazZ4tVIyWnDj7XXuqNC3vYplH32KPDfhFPvMVHPyuPqxrRPe6qoXAQ"
}