Improve FIPS mode
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
https://www.erlang.org/doc/apps/crypto/fips.html
1. The first step is to enable FIPS mode when compiling Erlang. That merely allows toggling it on / off if the underlying crypto library (OpenSSL) supports it. For our packaging we can do that here https://github.com/apache/couchdb-ci/pull/44.
2. Implement a runtime FIPS mode toggle. Currently we can enable it at compile time, however, that requires having two builds, two package flavors etc., Instead, use a runtime config option to toggle it. In [couch_hash](https://github.com/apache/couchdb/blob/main/src/couch/src/couch_hash.erl#L17-L45), to avoid a performance impact, use a [persistent term](https://www.erlang.org/doc/man/persistent_term.html) to minimize config ETS lookups if performance degradation is of concern. (Implemented in https://github.com/apache/couchdb/pull/4443)
3. FIPS mode, when enabled is already exposed in the [features list](https://github.com/apache/couchdb/blob/main/src/couch/src/couch_server.erl#L277-L283).
4. Add comments around each md5 usage explaining that it's not for cryptographic use.
5. Any places where TLS is used, would potentially need to reduce the [list of advertised algorithms / curves / parameters](https://esl.github.io/MongooseDocs/latest/developers-guide/OpenSSL-and-FIPS/) to conform to the FIPS approved list. If that's not done it would lead to `unsupported` crashes and exception during attempted use. A few places that might happen:
- chttpd (mochiweb) TLS support
- couch_replicator (ibrowse)
- Erlang intra-node TLS
Contributor guide
Research direction
Review the Erlang FIPS documentation and the remaining scope after couchdb/pull/4443. Inspect couch_hash.erl, couch_server.erl, and the chttpd, couch_replicator, and intra-node TLS areas, then locate MD5 uses. Done means runtime FIPS behavior, non-cryptographic MD5 uses documented, and TLS options conforming to the approved set without unsupported failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100