···631631 </listitem>
632632 <listitem>
633633 <para>
634634+ The <literal>openssl</literal>-extension for the PHP
635635+ interpreter used by Nextcloud is built against OpenSSL 1.1 if
636636+ <xref linkend="opt-system.stateVersion" /> is below
637637+ <literal>22.11</literal>. This is to make sure that people
638638+ using
639639+ <link xlink:href="https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html">server-side
640640+ encryption</link> don’t loose access to their files.
641641+ </para>
642642+ <para>
643643+ In any other case it’s safe to use OpenSSL 3 for PHP’s openssl
644644+ extension. This can be done by setting
645645+ <xref linkend="opt-services.nextcloud.enableBrokenCiphersForSSE" />
646646+ to <literal>false</literal>.
647647+ </para>
648648+ </listitem>
649649+ <listitem>
650650+ <para>
634651 The <literal>coq</literal> package and versioned variants
635652 starting at <literal>coq_8_14</literal> no longer include
636653 CoqIDE, which is now available through
+7
nixos/doc/manual/release-notes/rl-2211.section.md
···204204205205- The `p4` package now only includes the open-source Perforce Helix Core command-line client and APIs. It no longer installs the unfree Helix Core Server binaries `p4d`, `p4broker`, and `p4p`. To install the Helix Core Server binaries, use the `p4d` package instead.
206206207207+- The `openssl`-extension for the PHP interpreter used by Nextcloud is built against OpenSSL 1.1 if
208208+ [](#opt-system.stateVersion) is below `22.11`. This is to make sure that people using [server-side encryption](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html)
209209+ don't loose access to their files.
210210+211211+ In any other case it's safe to use OpenSSL 3 for PHP's openssl extension. This can be done by setting
212212+ [](#opt-services.nextcloud.enableBrokenCiphersForSSE) to `false`.
213213+207214- The `coq` package and versioned variants starting at `coq_8_14` no
208215 longer include CoqIDE, which is now available through
209216 `coqPackages.coqide`. It is still possible to get CoqIDE as part of
+57-1
nixos/modules/services/web-apps/nextcloud.nix
···1313 phpPackage = cfg.phpPackage.buildEnv {
1414 extensions = { enabled, all }:
1515 (with all;
1616- enabled
1616+ # disable default openssl extension
1717+ (lib.filter (e: e.pname != "php-openssl") enabled)
1818+ # use OpenSSL 1.1 for RC4 Nextcloud encryption if user
1919+ # has acknowledged the brokeness of the ciphers (RC4).
2020+ # TODO: remove when https://github.com/nextcloud/server/issues/32003 is fixed.
2121+ ++ (if cfg.enableBrokenCiphersForSSE then [ cfg.phpPackage.extensions.openssl-legacy ] else [ cfg.phpPackage.extensions.openssl ])
1722 ++ optional cfg.enableImagemagick imagick
1823 # Optionally enabled depending on caching settings
1924 ++ optional cfg.caching.apcu apcu
···80858186 options.services.nextcloud = {
8287 enable = mkEnableOption (lib.mdDoc "nextcloud");
8888+8989+ enableBrokenCiphersForSSE = mkOption {
9090+ type = types.bool;
9191+ default = versionOlder stateVersion "22.11";
9292+ defaultText = literalExpression "versionOlder system.stateVersion \"22.11\"";
9393+ description = lib.mdDoc ''
9494+ This option enables using the OpenSSL PHP extension linked against OpenSSL 1.1
9595+ rather than latest OpenSSL (≥ 3), this is not recommended unless you need
9696+ it for server-side encryption (SSE). SSE uses the legacy RC4 cipher which is
9797+ considered broken for several years now. See also [RFC7465](https://datatracker.ietf.org/doc/html/rfc7465).
9898+9999+ This cipher has been disabled in OpenSSL ≥ 3 and requires
100100+ a specific legacy profile to re-enable it.
101101+102102+ If you deploy Nextcloud using OpenSSL ≥ 3 for PHP and have
103103+ server-side encryption configured, you will not be able to access
104104+ your files anymore. Enabling this option can restore access to your files.
105105+ Upon testing we didn't encounter any data corruption when turning
106106+ this on and off again, but this cannot be guaranteed for
107107+ each Nextcloud installation.
108108+109109+ It is `true` by default for systems with a [](#opt-system.stateVersion) below
110110+ `22.11` to make sure that existing installations won't break on update. On newer
111111+ NixOS systems you have to explicitly enable it on your own.
112112+113113+ Please note that this only provides additional value when using
114114+ external storage such as S3 since it's not an end-to-end encryption.
115115+ If this is not the case,
116116+ it is advised to [disable server-side encryption](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html#disabling-encryption) and set this to `false`.
117117+118118+ In the future, Nextcloud may move to AES-256-GCM, by then,
119119+ this option will be removed.
120120+ '';
121121+ };
83122 hostName = mkOption {
84123 type = types.str;
85124 description = lib.mdDoc "FQDN for the nextcloud instance.";
···649688 ++ (optional (versionOlder cfg.package.version "23") (upgradeWarning 22 "22.05"))
650689 ++ (optional (versionOlder cfg.package.version "24") (upgradeWarning 23 "22.05"))
651690 ++ (optional (versionOlder cfg.package.version "25") (upgradeWarning 24 "22.11"))
691691+ ++ (optional cfg.enableBrokenCiphersForSSE ''
692692+ You're using PHP's openssl extension built against OpenSSL 1.1 for Nextcloud.
693693+ This is only necessary if you're using Nextcloud's server-side encryption.
694694+ Please keep in mind that it's using the broken RC4 cipher.
695695+696696+ If you don't use that feature, you can switch to OpenSSL 3 and get
697697+ rid of this warning by declaring
698698+699699+ services.nextcloud.enableBrokenCiphersForSSE = false;
700700+701701+ If you need to use server-side encryption you can ignore this waring.
702702+ Otherwise you'd have to disable server-side encryption first in order
703703+ to be able to safely disable this option and get rid of this warning.
704704+ See <https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html#disabling-encryption> on how to achieve this.
705705+706706+ For more context, here is the implementing pull request: https://github.com/NixOS/nixpkgs/pull/198470
707707+ '')
652708 ++ (optional isUnsupportedMariadb ''
653709 You seem to be using MariaDB at an unsupported version (i.e. at least 10.6)!
654710 Please note that this isn't supported officially by Nextcloud. You can either
+14
nixos/modules/services/web-apps/nextcloud.xml
···170170 </listitem>
171171 </itemizedlist>
172172 </listitem>
173173+ <listitem>
174174+ <formalpara>
175175+ <title>Server-side encryption</title>
176176+ <para>
177177+ Nextcloud supports <link xlink:href="https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/encryption_configuration.html">server-side encryption (SSE)</link>.
178178+ This is not an end-to-end encryption, but can be used to encrypt files that will be persisted
179179+ to external storage such as S3. Please note that this won't work anymore when using OpenSSL 3
180180+ for PHP's openssl extension because this is implemented using the legacy cipher RC4.
181181+ If <xref linkend="opt-system.stateVersion" /> is <emphasis>above</emphasis> <literal>22.05</literal>,
182182+ this is disabled by default. To turn it on again and for further information please refer to
183183+ <xref linkend="opt-services.nextcloud.enableBrokenCiphersForSSE" />.
184184+ </para>
185185+ </formalpara>
186186+ </listitem>
173187 </itemizedlist>
174188 </section>
175189
+7
nixos/tests/nextcloud/basic.nix
···3737 "d /var/lib/nextcloud-data 0750 nextcloud nginx - -"
3838 ];
39394040+ system.stateVersion = "22.11"; # stateVersion >=21.11 to make sure that we use OpenSSL3
4141+4042 services.nextcloud = {
4143 enable = true;
4244 datadir = "/var/lib/nextcloud-data";
···99101 # This is just to ensure the nextcloud-occ program is working
100102 nextcloud.succeed("nextcloud-occ status")
101103 nextcloud.succeed("curl -sSf http://nextcloud/login")
104104+ # Ensure that no OpenSSL 1.1 is used.
105105+ nextcloud.succeed(
106106+ "${nodes.nextcloud.services.phpfpm.pools.nextcloud.phpPackage}/bin/php -i | grep 'OpenSSL Library Version' | awk -F'=>' '{ print $2 }' | awk '{ print $2 }' | grep -v 1.1"
107107+ )
102108 nextcloud.succeed(
103109 "${withRcloneEnv} ${copySharedFile}"
104110 )
···108114 "${withRcloneEnv} ${diffSharedFile}"
109115 )
110116 assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
117117+ nextcloud.succeed("grep -vE '^HBEGIN:oc_encryption_module' /var/lib/nextcloud-data/data/root/files/test-shared-file")
111118 '';
112119})) args
···9191 [ ]
9292 allExtensionFunctions;
93939494- getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
9494+ getExtName = ext: ext.extensionName;
95959696 # Recursively get a list of all internal dependencies
9797 # for a list of extensions.
+15-4
pkgs/top-level/php-packages.nix
···7373 # will mark the extension as a zend extension or not.
7474 mkExtension = lib.makeOverridable
7575 ({ name
7676- , configureFlags ? [ "--enable-${name}" ]
7676+ , configureFlags ? [ "--enable-${extName}" ]
7777 , internalDeps ? [ ]
7878 , postPhpize ? ""
7979 , buildInputs ? [ ]
8080 , zendExtension ? false
8181 , doCheck ? true
8282+ , extName ? name
8283 , ...
8384 }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
8485 pname = "php-${name}";
8585- extensionName = name;
8686+ extensionName = extName;
86878788 outputs = [ "out" "dev" ];
8889···105106106107 cdToExtensionRootPhase = ''
107108 # Go to extension source root.
108108- cd "ext/${name}"
109109+ cd "ext/${extName}"
109110 '';
110111111112 preConfigure = ''
···141142 runHook preInstall
142143143144 mkdir -p $out/lib/php/extensions
144144- cp modules/${name}.so $out/lib/php/extensions/${name}.so
145145+ cp modules/${extName}.so $out/lib/php/extensions/${extName}.so
145146 mkdir -p $dev/include
146147 ${rsync}/bin/rsync -r --filter="+ */" \
147148 --filter="+ *.h" \
···413414 {
414415 name = "openssl";
415416 buildInputs = if (lib.versionAtLeast php.version "8.1") then [ openssl ] else [ openssl_1_1 ];
417417+ configureFlags = [ "--with-openssl" ];
418418+ doCheck = false;
419419+ }
420420+ # This provides a legacy OpenSSL PHP extension
421421+ # For situations where OpenSSL 3 do not support a set of features
422422+ # without a specific openssl.cnf file
423423+ {
424424+ name = "openssl-legacy";
425425+ extName = "openssl";
426426+ buildInputs = [ openssl_1_1 ];
416427 configureFlags = [ "--with-openssl" ];
417428 doCheck = false;
418429 }