about summary refs log tree commit diff
path: root/pkgs/servers/nextcloud
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-07-13 05:28:20 -0700
committerRobert Schütz <nix@dotlambda.de>2023-07-13 05:29:19 -0700
commit6b8186f4050d61f774bb4a6c61fcd72c1a07069a (patch)
tree1ca9f4c53ac4e43d72a317d1151d2b144da4e8f3 /pkgs/servers/nextcloud
parente2261431b73a7e7f0e40bbd1a9f35e090381ecf1 (diff)
downloadnixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar.gz
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar.bz2
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar.lz
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar.xz
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.tar.zst
nixlib-6b8186f4050d61f774bb4a6c61fcd72c1a07069a.zip
nextcloud24: remove unused patch
nextcloud24 was removed in 430f1dcdbd362d9c37ba516edbb395570df47339
Diffstat (limited to 'pkgs/servers/nextcloud')
-rw-r--r--pkgs/servers/nextcloud/patches/v24/0001-Setup-remove-custom-dbuser-creation-behavior.patch138
1 files changed, 0 insertions, 138 deletions
diff --git a/pkgs/servers/nextcloud/patches/v24/0001-Setup-remove-custom-dbuser-creation-behavior.patch b/pkgs/servers/nextcloud/patches/v24/0001-Setup-remove-custom-dbuser-creation-behavior.patch
deleted file mode 100644
index f8ff9b7c553c..000000000000
--- a/pkgs/servers/nextcloud/patches/v24/0001-Setup-remove-custom-dbuser-creation-behavior.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From e01014a745b7f4dbdde2ee0e293c25c4e5eeaabb Mon Sep 17 00:00:00 2001
-From: Maximilian Bosch <maximilian@mbosch.me>
-Date: Sat, 10 Sep 2022 15:18:05 +0200
-Subject: [PATCH] Setup: remove custom dbuser creation behavior
-
-Both PostgreSQL and MySQL can be authenticated against from Nextcloud by
-supplying a database password. Now, during setup the following things
-happen:
-
-* When using postgres and the db user has elevated permissions, a new
-  unprivileged db user is created and the settings `dbuser`/`dbpass` are
-  altered in `config.php`.
-
-* When using MySQL, the password is **always** regenerated since
-  24.0.5/23.0.9[1].
-
-I consider both cases problematic: the reason why people do configuration
-management is to have it as single source of truth! So, IMHO any
-application that silently alters config and thus causes deployed
-nodes to diverge from the configuration is harmful for that.
-
-I guess it was sheer luck that it worked for so long in NixOS because
-nobody has apparently used password authentication with a privileged
-user to operate Nextcloud (which is a good thing in fact).
-
-[1] https://github.com/nextcloud/server/pull/33513
----
- lib/private/Setup/MySQL.php      | 56 --------------------------------
- lib/private/Setup/PostgreSQL.php | 26 ---------------
- 2 files changed, 82 deletions(-)
-
-diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
-index fbce31b0f57..9b2265091f0 100644
---- a/lib/private/Setup/MySQL.php
-+++ b/lib/private/Setup/MySQL.php
-@@ -142,62 +142,6 @@ class MySQL extends AbstractDatabase {
- 		$rootUser = $this->dbUser;
- 		$rootPassword = $this->dbPassword;
- 
--		//create a random password so we don't need to store the admin password in the config file
--		$saveSymbols = str_replace(['\"', '\\', '\'', '`'], '', ISecureRandom::CHAR_SYMBOLS);
--		$password = $this->random->generate(22, ISecureRandom::CHAR_ALPHANUMERIC . $saveSymbols)
--			. $this->random->generate(2, ISecureRandom::CHAR_UPPER)
--			. $this->random->generate(2, ISecureRandom::CHAR_LOWER)
--			. $this->random->generate(2, ISecureRandom::CHAR_DIGITS)
--			. $this->random->generate(2, $saveSymbols)
--		;
--		$this->dbPassword = str_shuffle($password);
--
--		try {
--			//user already specified in config
--			$oldUser = $this->config->getValue('dbuser', false);
--
--			//we don't have a dbuser specified in config
--			if ($this->dbUser !== $oldUser) {
--				//add prefix to the admin username to prevent collisions
--				$adminUser = substr('oc_' . $username, 0, 16);
--
--				$i = 1;
--				while (true) {
--					//this should be enough to check for admin rights in mysql
--					$query = 'SELECT user FROM mysql.user WHERE user=?';
--					$result = $connection->executeQuery($query, [$adminUser]);
--
--					//current dbuser has admin rights
--					$data = $result->fetchAll();
--					$result->closeCursor();
--					//new dbuser does not exist
--					if (count($data) === 0) {
--						//use the admin login data for the new database user
--						$this->dbUser = $adminUser;
--						$this->createDBUser($connection);
--
--						break;
--					} else {
--						//repeat with different username
--						$length = strlen((string)$i);
--						$adminUser = substr('oc_' . $username, 0, 16 - $length) . $i;
--						$i++;
--					}
--				}
--			} else {
--				// Reuse existing password if a database config is already present
--				$this->dbPassword = $rootPassword;
--			}
--		} catch (\Exception $ex) {
--			$this->logger->info('Can not create a new MySQL user, will continue with the provided user.', [
--				'exception' => $ex,
--				'app' => 'mysql.setup',
--			]);
--			// Restore the original credentials
--			$this->dbUser = $rootUser;
--			$this->dbPassword = $rootPassword;
--		}
--
- 		$this->config->setValues([
- 			'dbuser' => $this->dbUser,
- 			'dbpassword' => $this->dbPassword,
-diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php
-index bc24909dc3d..e49e5508e15 100644
---- a/lib/private/Setup/PostgreSQL.php
-+++ b/lib/private/Setup/PostgreSQL.php
-@@ -45,32 +45,6 @@ class PostgreSQL extends AbstractDatabase {
- 			$connection = $this->connect([
- 				'dbname' => 'postgres'
- 			]);
--			//check for roles creation rights in postgresql
--			$builder = $connection->getQueryBuilder();
--			$builder->automaticTablePrefix(false);
--			$query = $builder
--				->select('rolname')
--				->from('pg_roles')
--				->where($builder->expr()->eq('rolcreaterole', new Literal('TRUE')))
--				->andWhere($builder->expr()->eq('rolname', $builder->createNamedParameter($this->dbUser)));
--
--			try {
--				$result = $query->execute();
--				$canCreateRoles = $result->rowCount() > 0;
--			} catch (DatabaseException $e) {
--				$canCreateRoles = false;
--			}
--
--			if ($canCreateRoles) {
--				//use the admin login data for the new database user
--
--				//add prefix to the postgresql user name to prevent collisions
--				$this->dbUser = 'oc_' . strtolower($username);
--				//create a new password so we don't need to store the admin config in the config file
--				$this->dbPassword = \OC::$server->getSecureRandom()->generate(30, ISecureRandom::CHAR_ALPHANUMERIC);
--
--				$this->createDBUser($connection);
--			}
- 
- 			$this->config->setValues([
- 				'dbuser' => $this->dbUser,
--- 
-2.39.1
-