Recently we had deployed a Flask application on a RHEL9 server where FIPS mode was enabled. It started find but refused to serve any requests. The logs were filled with Unsupported DigestmodError messages.
FIPS (which stands for Federal Information Processing Standards) mode will not allow you system-wide to use any hashing algo that is considered to be insecure. But vanilla Flask (and it's batteries) often using sha1. We have stumbled upon two cases.
A standard Flask stack often uses sha1 by default in two key places
flask sessions
The default secure cookie sessions are using itsdangerious for signing, which can default to sha1. The fix was easy: fask's session interface is designed to be subclassed. We can create a custom session class inheriting it from SecureCookieSessionInterface and tell it to use sha256 as the digest method
flask-wtf
Serializing and signing CSRF token here also uses itsdangerious, that again, defaults to sha1. This is the trickier part. As for now, flask_wtf does not provide a simple config option to change the digest method. We have to create a custom CSRFProtect implementation forcing it to use sha256 serializer.
Recently, I faced an issue where curl (and browsers) couldn't resolve a hostname, but other tools like dig and nslookup worked fine. I want to share how I solved this problem in a simple way.
Another post to the “suffering journal”. Experienced a lot of hardware fails:
SSD disks become read-only or other IO errors
Video card do not start while power on. Had to restart each time.
Other system freezes of unknown origin.
It happened for a month, and I tried to replace SATA cables, disable “spoiled” disks, do memory checks, use the rest of the voodoo too. Started scaring myself with a shopping list if the motherboard broke.
It was a power unit. No visible signs like an inflated capacitor or burn marks, though. Took a chance and bought a new PU. All problems are gone.
I've spent almost two weeks without a laptop and very restricted mobile internet. When I sat at the keyboard again, there was no that excitement level as it used to be, even close. Maybe I'm just so tired after more or less hardcore trailing experience.
That place is a nice tool for writing by the way. It could be a neat tool to draft post ideas and tidy up formatting. But such short posts should not exist as a blog post and it fits tweet format which is not my intention.