Skip to content

Commit

Permalink
Make FIPS not use ReadonlyRootfsManager as due to systemd-sysext
Browse files Browse the repository at this point in the history
…usage we wont be able to make `/usr` writeable anymore (#15000)
  • Loading branch information
themylogin authored Nov 21, 2024
1 parent d8105ea commit 9640b06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions debian/debian/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -ex

mkdir -p /var/lib/ssl
mv /usr/lib/ssl/fipsmodule.cnf /var/lib/ssl/fipsmodule.cnf
ln -s /var/lib/ssl/fipsmodule.cnf /usr/lib/ssl/fipsmodule.cnf
Empty file modified src/freenas/debian/preinst
100644 → 100755
Empty file.
7 changes: 2 additions & 5 deletions src/middlewared/middlewared/scripts/configure_fips.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import subprocess

from middlewared.utils.db import query_config_table
from middlewared.utils.rootfs import ReadonlyRootfsManager


FIPS_MODULE_FILE = '/usr/lib/ssl/fipsmodule.cnf'
Expand Down Expand Up @@ -43,14 +42,12 @@ def main() -> None:
try:
security_settings = query_config_table('system_security')
except (sqlite3.OperationalError, IndexError):
# This is for the case when users are upgrading and in that case table will not exist
# This is for the case when users are upgrading and in that case table will not exist,
# so we should always disable fips as a default because users might not be able to ssh
# into the system
security_settings = {'enable_fips': False}

with ReadonlyRootfsManager('/') as readonly_rootfs:
readonly_rootfs.make_writeable()
configure_fips(security_settings['enable_fips'])
configure_fips(security_settings['enable_fips'])


if __name__ == '__main__':
Expand Down

0 comments on commit 9640b06

Please sign in to comment.