Giter Site home page Giter Site logo

user_sql's Introduction

user_sql

Nextcloud SQL user authentication.

screenshot

Use external database as a source for Nextcloud users and groups. Retrieve the users and groups info. Allow the users to change their passwords. Sync the users' email addresses with the addresses stored by Nextcloud.

Getting Started

  1. SSH into your server.

  2. Get into the apps folder of your Nextcloud installation, for example /var/www/nextcloud/apps.

  3. Git clone this project: git clone https://github.com/nextcloud/user_sql.git.

  4. Login to your Nextcloud instance as admin.

  5. Navigate to Apps from the menu then find and enable the User and Group SQL Backends app.

  6. Navigate to Admin from menu and switch to Additional Settings, scroll down the page and you will see SQL Backends settings.

You can skip the first three steps as this app is available in the official Nextcloud App Store.

Configuration

Below are detailed descriptions of all available options.

Database connection

This section contains the database connection parameters.

Name Description Details
SQL driver The database driver to use. Currently supported drivers are: mysql, pgsql. Mandatory.
Hostname The hostname on which the database server resides. Mandatory.
Database The name of the database. Mandatory.
Username The name of the user for the connection. Optional.
Password The password of the user for the connection. Optional.
SSL CA The file path to the SSL certificate authority (relative to Nextcloud serverroot) Optional.
Requires: SQL driver mysql.
SSL Certificate The file path to the SSL certificate (relative to Nextcloud serverroot) Optional.
Requires: SQL driver mysql.
SSL Key The file path to the SSL key (relative to Nextcloud serverroot) Optional.
Requires: SQL driver mysql.
System wide values Place where database connection parameters are stored.
- true - config.php (System wide values).
- false - database (App values).
Optional.
Default: false.

Options

Here are all currently supported options.

Name Description Details
Allow display name change With this option enabled user can change its display name. The display name change is propagated to the database. Optional.
Default: false.
Requires: user Display name column.
Allow email login User input at login is considered to be either UID or email. Optional.
Default: false.
Requires: user Email column.
Allow password change Can user change its password. The password change is propagated to the database. See Hash algorithms. Optional.
Default: false.
Allow providing avatar Can user provide its avatar. The value is used when column Provide avatar is not set. Optional.
Default: false.
Case-insensitive username Whether user query should be case-sensitive or case-insensitive. Optional.
Default: false.
Reverse active column Reverse value of active column in user table. Optional.
Default: false.
Use cache Use database query results cache. The cache can be cleared any time with the Clear cache button click. Optional.
Default: false.
Hash algorithm How users passwords are stored in the database. See Hash algorithms. Mandatory.
Name sync Sync display name with the Nextcloud.
- None - Disables this feature. This is the default option.
- Synchronise only once - Copy the display name to the Nextcloud preferences if its not set.
- Nextcloud always wins - Always copy the display name to the database. This updates the user table.
- SQL always wins - Always copy the display name to the Nextcloud preferences.
Optional.
Default: None.
Requires: user Display name column.
Email sync Sync e-mail address with the Nextcloud.
- None - Disables this feature. This is the default option.
- Synchronise only once - Copy the e-mail address to the Nextcloud preferences if its not set.
- Nextcloud always wins - Always copy the e-mail address to the database. This updates the user table.
- SQL always wins - Always copy the e-mail address to the Nextcloud preferences.
Optional.
Default: None.
Requires: user Email column.
Quota sync Sync user quota with the Nextcloud.
- None - Disables this feature. This is the default option.
- Synchronise only once - Copy the user quota to the Nextcloud preferences if its not set.
- Nextcloud always wins - Always copy the user quota to the database. This updates the user table.
- SQL always wins - Always copy the user quota to the Nextcloud preferences.
Optional.
Default: None.
Requires: user Quota column.
Home mode User storage path.
- Default - Let the Nextcloud manage this. The default option.
- Query - Use location from the user table pointed by the home column.
- Static - Use static location pointed by the Home Location option.
Optional
Default: Default.
Home location User storage path for the Static Home mode. The %u variable is replaced with the uid of the user. Mandatory if the Home mode is set to Static.
Default group Default group for all 'User SQL' users. Optional.

User table

The definition of user table. The table containing user accounts.

Name Description Details
Table name The table name. Mandatory for user backend.
UID User ID column. Mandatory for user backend.
Username Username column which is used only for password verification. Optional. If unsure leave it blank and use only the uid column.
Email E-mail column. Mandatory for Email sync option.
Quota Quota column. Mandatory for Quota sync option.
Home Home path column. Mandatory for Query Home sync option.
Password Password hash column. Mandatory for user backend.
Display name Display name column. Optional.
Active Flag indicating if user can log in. Optional.
Default: true.
Disabled Flag indicating if user should not be visible (not included in searches). Optional.
Default: false.
Provide avatar Flag indicating if user can change its avatar. Optional.
Default: false.
Salt Salt which is appended to password when checking or changing the password. Optional.
Append salt Append a salt to the password. Optional.
Default: false.
Prepend salt Prepend a salt to the password. Optional.
Default: false.

Group table

The group definitions table.

Name Description Details
Table name The table name. Mandatory for group backend.
GID Group ID column. Mandatory for group backend.
Display name Display name column. Optional.
Is admin Flag indicating if its the admin group Optional.

User group table

Associative table which maps users to groups.

Name Description Details
Table name The table name. Mandatory for group backend.
UID User ID column. Mandatory for group backend.
GID Group ID column. Mandatory for group backend.

Integrations

The basic functionality requires only one database table: User table.

For all options to work three tables are required:

If you already have an existing database you can always create database views which fits this model, but be aware that some functionalities requires data changes (update queries).

If you don't have any database model yet you can use below tables (MySQL). Please note that the optional username above really is only used for password matching and defaults to be equal to the uid column. You also may want to compare with the oc_users and oc_groups table from you Nextcloud instance.

CREATE TABLE sql_user
(
  uid            VARCHAR(64) PRIMARY KEY,
  display_name   TEXT        NULL,
  email          TEXT        NULL,
  quota          TEXT        NULL,
  home           TEXT        NULL,
  password       TEXT        NOT NULL,
  active         TINYINT(1)  NOT NULL DEFAULT '1',
  disabled       TINYINT(1)  NOT NULL DEFAULT '0',
  provide_avatar BOOLEAN     NOT NULL DEFAULT FALSE,
  salt           TEXT        NULL
);

CREATE TABLE sql_group
(
  gid   VARCHAR(64)  PRIMARY KEY,
  name  VARCHAR(255) NOT NULL,
  admin BOOLEAN      NOT NULL DEFAULT FALSE
);

CREATE TABLE sql_user_group
(
  uid   VARCHAR(64),
  gid   VARCHAR(64),
  PRIMARY KEY (uid, gid),
  FOREIGN KEY (uid) REFERENCES sql_user (uid),
  FOREIGN KEY (gid) REFERENCES sql_group (gid),
  INDEX user_group_username_idx (uid),
  INDEX user_group_group_name_idx (gid)
);

WordPress

Thanks to this app, Nextcloud can easily integrate with Wordpress.

In the Nextcloud user table settings of SQL Backends, configure it as:

User table: wp_users
Username column: user_login
Password column: user_pass

Hash algorithm: Unix (Crypt) or Portable PHP password

JHipster

It is very easy to integrate Nextcloud with JHipster.

Follow the Using the Database instructions in Using Jhipster in development to configure your database. Assume you chose MySQL as JHipster database. In the Nextcloud user table settings of SQL Backends, configure it as:

User table: jhi_users
Username column: login
Password column: password_hash
Email column: email
Active column: activated

Hash algorithm: Unix (Crypt)

Hash algorithms

Below is a table containing all of the supported hash implementations with example hashes. The hashed password is "password", the salt if required have been generated randomly.

Hash name Details Hash example value
Cleartext Never use this. Only for development. password
Courier base64-encoded MD5 No salt supported. {MD5RAW}5f4dcc3b5aa765d61d8327deb882cf99
Courier hexadecimal MD5 No salt supported. {MD5}X03MO1qnZdYdgyfeuILPmQ==
Courier base64-encoded SHA1 No salt supported. {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
Courier base64-encoded SHA256 No salt supported. {SHA256}XohImNooBHFR0OVvjcYpJ3NgPQ1qq73WKhHvch0VQtg=
Unix (Crypt) See crypt. $2y$10$5rsN1fmoSkaRy9bqhozAXOr0mn0QiVIfd2L04Bbk1Go9MjdvotwBq
Argon2i (Crypt) Requires PHP >= 7.2. See password_hash. $argon2i$v=19$m=1024,t=2,p=2$NnpSNlRNLlZobnJHUDh0Sw$oW5E1cfdPzLWfkTvQFUyzTR00R0aLwEdYwldcqW6Pmo
Argon2id (Crypt) Requires PHP >= 7.2. See password_hash. $argon2id$v=19$m=65536,t=4,p=1$eWhTd3huemlhNGFkWTVSSQ$BjSh9PINc9df9WU1zppBsYJKvkwUEYHYNUUMTj+QGPw
Blowfish (Crypt) See password_hash. $2y$10$5rsN1fmoSkaRy9bqhozAXOr0mn0QiVIfd2L04Bbk1Go9MjdvotwBq
Extended DES (Crypt) cDRpdxPmHpzS.
Hash HMAC See hash_hmac. ba4f8624f0a4d1f2a3991f4d88cd9afb604dac20
MD5 (Crypt) $1$RzaFbNcU$u9adfTY/Q6za6nu0Ogrl1/
SHA256 (Crypt) $5$rounds=5000$VIYD0iHkg7uY9SRc$v2XLS/9dvfFN84mzGvW9wxnVt9Xd/urXaaTkpW8EwD1
SHA512 (Crypt) $6$rounds=5000$yH.Q0OL4qbCOUJ3q$Xry5EVFva3wKnfo8/ktrugmBd8tcl34NK6rXInv1HhmdSUNLEm0La9JnA57rqwQ.9/Bz513MD4tvmmISLUIHs/
Standard DES (Crypt) yTBnb7ab/N072
Drupal 7 See phpass. $S$DC7eCpJQ3SUQtW4Bp.vKb2rpeaffi4iqk9OpYwJyEoSMsezn67Sl
Joomla MD5 Encryption Generates 32 chars salt. 14d21b49b0f13e2acba962b6b0039edd:haJK0yTvBXTNMh76xwEw5RYEVpJsN8us
MD5 5f4dcc3b5aa765d61d8327deb882cf99
Portable PHP password See phpass. $P$BxrwraqNTi4as0EI.IpiA/K.muk9ke/
Redmine Requires salt. Salt value for hash in the next column is 'salt'. 48b75edeffd8e413341d7734f0f3391e7a5da994
SHA-1 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
SHA-256 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
SHA-512 b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86
SHA-512 Whirlpool a96b16ebb691dbe968b0d66d0d924cff5cf5de5e0885181d00761d87f295b2bf3d3c66187c050fc01c196ff3acaa48d3561ffd170413346e934a32280d632f2e
SSHA256 Generates 32 chars salt. {SSHA256}+WxTB3JxprNteeovsuSYtgI+UkVPA9lfwGoYkz3Ff7hjd1FSdmlTMkNsSExyR21KM3NvNTZ5V0p4WXJMUjFzUg==
SSHA512 Generates 32 chars salt. {SSHA512}It+v1kAEUBbhMJYJ2swAtz+RLE6ispv/FB6G/ALhK/YWwEmrloY+0jzrWIfmu+rWUXp8u0Tg4jLXypC5oXAW00IyYnRVdEZJbE9wak96bkNRVWFCYmlJNWxrdTA0QmhL
WoltLab Community Framework 2.x Double salted bcrypt. $2a$08$XEQDKNU/Vbootwxv5Gp7gujxFX/RUFsZLvQPYM435Dd3/p17fto02
Whirlpool 74dfc2b27acfa364da55f93a5caee29ccad3557247eda238831b3e9bd931b01d77fe994e4f12b9d4cfa92a124461d2065197d8cf7f33fc88566da2db2a4d6eae

Development

Testing environment

There is a vagrant box which you can use at development stage.

New database driver support

Add a new class in the OCA\UserSQL\Platform namespace which extends the AbstractPlatform class. Add this driver in admin.php template to $drivers variable and in method getPlatform(Connection $connection) of PlatformFactory class.

New hash algorithm support

Create a new class in OCA\UserSQL\Crypto namespace which implements IPasswordAlgorithm interface. Do not forget to write unit tests.

Acknowledgments

This repository contains continuation of work done in this repo. This plugin was heavily based on user_imap, user_pwauth, user_ldap and user_redmine!

Since version 4.0.0 the whole core implementation has been rewritten.

Credits

  • Andreas Boehler for releasing the first version of this application
  • Johan Hendriks provided his user_postfixadmin
  • Ed Wildgoose for fixing possible SQL injection vulnerability
  • Brandon Lee for implementing feature to separate uid from username resolving issues #108 & #121

user_sql's People

Contributors

brandonkerr avatar christophwurst avatar fxmw11 avatar gpgmailencrypt avatar ko- avatar mariusbluem avatar mlojewski-me avatar morrisjobke avatar nullcaller avatar palmtown avatar pauldeng avatar pedro-nonfree avatar pvalsecc avatar rotdrop avatar sebijk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

user_sql's Issues

Seems to connect fine to the DB but users can not login and admin->user has issues.

Ok I was really happy that the admin settings seems to access, verify and save the database settings fine...

But it seems I am still not there yet:

  1. When I go to the user listing there is just the this spinning circle and non of the users get shown. However the number of users on the left shows correctly the SQL user+internal users and if I open a group with only internal users it works as before.

  2. When I try to log in with one of the new SQL users it seems to accept the password and load the first page (even the feed-reader popup comes) but then I get an "internal server error" from Nextcloud.

My error log doesn't seem to give me anything useful either...

Any hints much appreciated.

Install Problem: admin-form does not show up

Can not enter sql-admin data in ...nextcloud/index.php/settings/admin/additional (as admin)
App shows up in app-list, can be activated and deactivated.
Tested several ways to install (download, app store) in version 4.0.x and 3.1.0.

I need some advise. Thanks!

Gets stuck "saving..." or "verifying..."

I am trying to integrate my Wordpress Mysql user database with NC12 (uses postgresql). According to the original documentation this should work with the Joomla phpass encryption.
However, with the recent v2.3.1.1-nc12 release I seem to not even get that far. When I put in the needed Mysql details and press "save" or "verify" it just shows the respective purple bar at the bottom indefinitely and never actually saves the settings.

Any idea what could be causing this? I am also authenticating a Dokuwiki against the same WP database (with this: https://www.dokuwiki.org/plugin:authwordpress ) so the problem is likely on the Nextcloud side of things.

Thanks a lot for any help.

authentication error with mariadb

I suspect that this plugin is not compatible with mariadb (which is the default mysql in debian 9 stable)

Looks like I configured succesfully a connection to a wordpress with mariadb using nextcloud

this is what says nextcloud.log when I try to login with a wordpress user

{
	"reqId": "RQZScPRis9H9T2pwoFkh",
	"level": 3,
	"time": "2018-05-31T22:19:17+00:00",
	"remoteAddr": "<masked>",
	"user": "admin",
	"app": "index",
	"method": "GET",
	"url": "/index.php/apps/files/",
	"message": "Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\SyntaxErrorException\",\"Message\":\"An exception occurred while executing 'SELECT  FROM wp_users WHERE user_login = :uid' with params [\\\"admin\\\"]:\\n\\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM wp_users WHERE user_login = 'admin'' at line 1\",\"Code\":0,\"Trace\":\"#0 \\/var\\/www\\/html\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\/var\\/www\\/html\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Statement.php(177): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'SELECT  FROM wp...', Array)\\n#2 \\/var\\/www\\/html\\/nextcloud\\/apps\\/user_sql\\/lib\\/helper.php(218): Doctrine\\\\DBAL\\\\Statement->execute()\\n#3 \\/var\\/www\\/html\\/nextcloud\\/apps\\/user_sql\\/lib\\/user_sql.php(594): OCA\\\\user_sql\\\\lib\\\\Helper->runQuery('getDisplayName', Array)\\n#4 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/User\\/User.php(120): OCA\\\\user_sql\\\\OC_USER_SQL->getDisplayName('admin')\\n#5 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/legacy\\/helper.php(603): OC\\\\User\\\\User->getDisplayName()\\n#6 \\/var\\/www\\/html\\/nextcloud\\/apps\\/files\\/lib\\/Controller\\/ViewController.php(131): OC_Helper::getStorageInfo('\\/', Object(OC\\\\Files\\\\FileInfo))\\n#7 \\/var\\/www\\/html\\/nextcloud\\/apps\\/files\\/lib\\/Controller\\/ViewController.php(160): OCA\\\\Files\\\\Controller\\\\ViewController->getStorageInfo()\\n#8 [internal function]: OCA\\\\Files\\\\Controller\\\\ViewController->index('', '', NULL, false)\\n#9 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(161): call_user_func_array(Array, Array)\\n#10 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(91): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#11 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/AppFramework\\/App.php(115): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files\\\\Controller\\\\ViewController), 'index')\\n#12 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/AppFramework\\/Routing\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('ViewController', 'index', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#13 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#14 \\/var\\/www\\/html\\/nextcloud\\/lib\\/private\\/Route\\/Router.php(297): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#15 \\/var\\/www\\/html\\/nextcloud\\/lib\\/base.php(999): OC\\\\Route\\\\Router->match('\\/apps\\/files\\/')\\n#16 \\/var\\/www\\/html\\/nextcloud\\/index.php(37): OC::handleRequest()\\n#17 {main}\",\"File\":\"\\/var\\/www\\/html\\/nextcloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Driver\\/AbstractMySQLDriver.php\",\"Line\":90}",
	"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36",
	"version": "13.0.2.1"
}

Feature Request: add quota managment from SQL

Quota App is really useful for limiting users Disk Space.

It would be really nice it there would be in option integrate user_sql with Quota, so there would be possible so set Quota in SQL and Nextcloud would read that information. For example like additional tables like done for groups.

Thank you for doing really useful plugin.

Additional field for numeric userid to link with groups?

Hello,

I am trying to link my Tikiwiki system to Nextcloud, but the problem I have is that in Tiki every user has a login name and a separate numeric userid. Thus by putting the login as the username column, I seem to be able to get the log-in working. But the groups are identified by the numeric userid and thus I can't link them to the login name in the current system.

Thanks for looking into it.

Make final version 4.0.0

Make final version 4.0.0 in master branch and publish it to app store. The version should support Nextcloud 14.

  • Merge branch develop-14 into develop
  • Remove branch develop-14
  • Merge branch develop into master (change version to 4.0.0)
  • Publish app in Nextcloud store
  • Change version in develop to 4.1.0-dev

How to configure it to work with Postgresql

Hi,

Really appreciate your work!

Issue:
user_sql can not work with Postgresql.

Description:
user_sql works fine with MySQL. However, when I configure it to work with Postgresql, it can connect to the db but does not list any tables. If I manually enter the table name, it complains cannot find it. Please check the screencast: https://youtu.be/imTSNCCVLEY

Here is my configuration:

  • OS: Ubuntu 16.04
  • NextCloud: 12.04
  • user_sql: 2.4 ( git version c6956d2)
  • postgresql: 9.5
  • Browser: firefox 57

I would love to contribute and make a better document.

Thanks a lot!
Merry Xmas and Happy New Year!

Cheers,
Paul

Which version should I use? (Nextcloud 13.0.5, SHA512 hashes)

Hi. I'm trying to enable this module. The only way I seem to be able to install is manually. (I originally began life on ownCloud 7 and have been upgrading ever since, it's entirely possible my app store doesn't work quite right...). I've been installing apps by untarring or git cloning into the right apps directory on my server.

If I go the app store page, it would have me install version 3.1.0, which (as far as I can tell) doesn't support SHA512 hashes. I can find it in the apps list and enable it. I can configure the database parameters correctly, and it connects to the database. But (I think) the reason login fails is because my password hashes are unsupported. (Password hashes in my database look like this: {SSHA512}abcde+ABCDE...)

If I follow the instructions in the README and do a git clone, I will see the app in the list of apps. I can't enable it. I get a warning that

App "User and Group SQL Backends" cannot be installed because it is not compatible with this version of the server.

Am I stuck? Is there any workaround or do I need to wait for Nextcloud 14?

[Request] Where clauses

Hej,

I'd find it nice to see being able to apply where clauses to the user / password column settings.

In my case I have a 'value' field which only holds the password, if a 'store' field says 'accounts'.

Drupal authentication

I have added user authentication against a Drupal 7 database as described here in the README. Not knowing if this may be helpful to others, I attach the changed files instead of committing them. If however, that would be included in future releases, I'd be happy.
usr_sql.drupal.zip

Support custom salts?

I seem to be working with a database that has a custom salt in it's database for each account in addition to the password hash. This is apparently done with the php hash() function utilizing the 'whirlpool' algorithm.

So maybe it would be possible to add a field where a account salt column could be selected?

Thanks a lot!

Cannot enable

Hi

Unfortunately I cannot enable user_sql using a fresh install of 13.0.1..
Any ideas?
image
Log:
image

Cheers

It is working but log gets flooded with unsupported type messages

I have a strange issue that my Nextcloud log is flooded with this message:

Error | OC_USER_SQL | Failed to connect to the database: Unsupported type:

Despite everything working fine. The type of the database in question is MySQL with InnoDB.

Maybe related to the fact that I created an SQL View to pull the group information?

Wordpress Login Discrepancy

Hello,
i am using user_sql (User and Group SQL Backends 4.0.1) in its latest version with nextcloud 14.0.3 and the latest wordpress version. User sync / login is working properly with your instructions (using portable PHP password).
There are only two slight issues that occur on my end:

  1. Wordpress username is not case sensitive (whereas i think nextcloud has case sensitive users). this results in the users being able to log in with any cased form of their username. but only if they use the exact case they signed up in wordpress with the folder permissions and the access in nextcloud will be correct.

  2. Using the wp stored email address to sign up doesn't work for my users currently

Are those issues known bugs? Or is there possibly a mistake in my configuration?

Kind regards and thanks in advance!

Remove deprecated hashing algorithm

Hello,
I noticed that this app supports some deprecated hashing algorithm, like MD5 and SHA1, which are proven not secure anymore. Wouldn't it be better to remove them from the list?
Best regards

Feature Request: Differentiate between userid and username

I would suggest to allow to differentiate between userid and username in the settings (and include username as a new attribute), because:

  • the username is often required for login purposes as well as sharing (rather than the userid)
  • the username might be subject to change, which would cause issues with the files and shares in NextCloud
  • the username could include special characters (based on the system you are connecting to) that might not be treated well by NextCloud for e.g. login or internal referencing

What are your thoughts?

Home Mode "Query" does not support datadirectory/home location setting

Nextcloud Version: 13.0.5
user_sql Version: master branch (4.0.0-rc2)

Settings

Home mode: Query
UserTable.Home: id
datadirectory: /var/www/oc_data
Home Location: /var/www/oc_data

Issue

I would have expected that with the setting for datadirectory and/or Home Location files are saved under: /var/www/oc_data/[id]
However, files are saved under: /var/www/public_html/[id]
(where [id] is the user's id)

Error The selected SQL table does not exist!

Hi Im useing nextcloud 13.0.3
I`ve install the plugin and try to config.
first it give me Successfully connected to database, then if I want to save the The selected SQL table does not exist! apper. It it the same with The selected SQL table wp_users does not exist!
Im a little noob, so please advice. Thank you

Error when 'Display name' column not set

"An error occured during the request. Unable to proceed." occurs when 'Display name' is not set.
The workaround is to set its value to the same value as Username column.

you have an error in you sql syntax

Hi I'm trying to get the SQL backend working for Nextcloud 13. While the login is succesfull i get an error right after logging in:

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details
Remote Address: 10.1.0.1
Request ID: pEmI5rzxuK55vseLl0cn

in the nextcloud log itself i got to see:

Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing 'SELECT FROM virtual_users WHERE email = :uid' with params ["[email protected]"]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM virtual_users WHERE email = '[email protected]'' at line 1

/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php - line 177: Doctrine\DBAL\DBALException driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'SELECT FROM vi...', Array)
/var/www/html/nextcloud/apps/user_sql/lib/helper.php - line 218: Doctrine\DBAL\Statement->execute()
/var/www/html/nextcloud/apps/user_sql/lib/user_sql.php - line 594: OCA\user_sql\lib\Helper->runQuery('getDisplayName', Array)
/var/www/html/nextcloud/lib/private/User/User.php - line 120: OCA\user_sql\OC_USER_SQL->getDisplayName('[email protected]...')
/var/www/html/nextcloud/lib/private/legacy/helper.php - line 603: OC\User\User->getDisplayName()
/var/www/html/nextcloud/apps/files/lib/Controller/ViewController.php - line 131: OC_Helper getStorageInfo('/', Object(OC\Files\FileInfo))
/var/www/html/nextcloud/apps/files/lib/Controller/ViewController.php - line 160: OCA\Files\Controller\ViewController->getStorageInfo()
[internal function] OCA\Files\Controller\ViewController->index('', '', NULL, false)
/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 161: call_user_func_array(Array, Array)
/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 91: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Files\Controller\ViewController), 'index')
/var/www/html/nextcloud/lib/private/AppFramework/App.php - line 115: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Files\Controller\ViewController), 'index')
/var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('ViewController', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
[internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
/var/www/html/nextcloud/lib/private/Route/Router.php - line 297: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
/var/www/html/nextcloud/lib/base.php - line 998: OC\Route\Router->match('/apps/files/')
/var/www/html/nextcloud/index.php - line 37: OC handleRequest()
{main}

Any idea how to solve this?
Can i deliver extra information, just let me know

Zjemm

Add support for algorithm parameters

Developed on: https://github.com/nextcloud/user_sql/tree/feature/issue%2346

In settings admin panel add hash algorithm options eg.

  • CryptBlowfish -> cost,
  • CryptArgon2 -> memory cost, time cost, threads
  • ...

Now workaround is to change it in code (constructor).

TODO:

  • Add dynamically generetaed numer fields in admin panel when choosing appropriate hash (Hash interface should now return array with name, visible name, default value and range - new method)
  • Add saving parameters in database
  • Add verifying new parameters range when saving configuration
  • Check and use these parameters when creating new hash instance
  • Add description of parameters in readme
  • Update changelog

User Groups are not Synchronized

Since the latest update the group syncing doesn't work anymore. Logging in works just fine. Does it matter that I got no options set in the group table?

Wordpress: how fill "UserGroups"?

Hi,

I've installed nextcloud and this addon. I've activated and configurated it.
When I try to login use my Wordpress login it say "Wrong password" all the times.
But in WP the password is correct.
I choose your recommended settings.

To test I've changed the encrypten method to "cleartext" and place a clear password in the database. Same problem.

Edit: It seems to be a problem if the group settings were not configurated. The log says:
Undefined index: groupTable at /var/www/virtual/test/html/nextcloud/apps/user_sql/ajax/settings.php#228
So im looking into wordpress codex where the userlevel are stored:
https://codex.wordpress.org/Database_Description#Table_Overview
Finally in wp_usermeta I've found the wp_user_level in the column meta_key. But the options here mixed so I cant configure it in you app.

changing password fails due to wrong SQL statement

Trying to change the password with disabled quota leads to the following SQL statement which fails. See in particular the non existing quota field:

'UPDATE mailbox SET
password = :password,
name = :name,
x_email = :email,
= :quota
WHERE
username = :uid' with params
["John Doe",
"$2y$10$52J53ZwP4nkF2Hd.4ZF94O21kogh11ReX\/4QTwltLXSrSai6r65A6",
"[email protected]", null,
"[email protected]"]:

Server Error 500

Hi, I tried to install the plugin but I get a warning:
Error: This app can not be enabled because it makes the server unstable
Then tried to enable it with the command occ enable:app user_sql
App gets enabled but return server error 500. had to uninstall it.

Running Nextcloud 13 and Php7.2

Login with email address fails if local-part has a dot

Nextcloud Version: 13.0.5
user_sql Version: master branch

I have observed a strange bug in this module on the login process.

Szenario:

User A has username test1 and email address [email protected] in my external database.
User B has username test2 and email address [email protected] in my external database.

So the only difference is that the local-part of user B's email address contains a additional char plus a dot sign.

Problem:

Both users can login with username and password.
User A can also login with email address, but not user B.

Adding hash compatibility for Woltlab Suite

Hello, it is possible to implement the hash algorithm from Woltlab?
Unfortunately it is currently not possible to authenticate the users from the Woltlab database with any hash option which is already implemented to this plugin.

Info:
The Woltlab dev´s says that he are using DoubleSalted bcrypt.
Here is a link which i became from the woltlab dev´s: https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/util/PasswordUtil.class.php

If you need any more information, please don't hesitate to write me.

It would be very great if you can implement this.

regards
Patrick

User_sql break group sharing when app activity is enabled

Since user_sql apps don't manage limit and offset in usersInGroup function:
$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true);

The unshareFromGroup function of Activity app start a infinity loop :

while (!empty($users)) {
			$this->addNotificationsForGroupUsers($users, 'unshared_by', $share->getNodeId(), $share->getNodeType(), $share->getTarget(), $share->getId());
			$offset += self::USER_BATCH_SIZE;
			$users = $group->searchUsers('', self::USER_BATCH_SIZE, $offset);
}

to fix that, just add offset and limit params to runQuery :

$rows = $this -> helper -> runQuery('getGroupUsers', array('gid' => $gid), false, true, ['limit' => $limit, 'offset' => $offset]);

Not an issue - usage query!

In principle this looks great though just can't work out how to use it! My understanding is that it allows users to login via an external authorisation table which is exactly what I was looking for!

I've installed and enabled the app and on the admin console I've setup the default domain with my database and user table. All settings are verified but nothing happens. I've set as SQL wins on the tab which I understand to mean that the external database is always more current.

The only thing I need to query in my setup is the field for user active column - what sort of field does this expect and what value does it expect. At present I've got a varchar(1) which is either Y or null so don't know if this is why nothing appears to be happening?

Any help much appreciated as this plugin is the missing piece of my puzzle!

Group functionality not working in 4.0

After upgrading to NC 14 and user_sql v4.0 the groups aren't fetched from the DB anymore.

I refilled my db setup like before but can't get groups to work.
Any idea what might be the reason for this?

Also I'm not quite sure of the role of the Group table. As far as I can see I didn't use that for the previous version and did get group functionality.

Did I get this correct that it just has to contain a list of available group names whcih are in turn referenced in the user_group table?

Update the app store!

I understand the app is updated for Nc 11 and 12, would be great to upload the new versions to the app store!

Nextcloud 14 will drop OCP\JSON support

Hi @mlojewski-me, OCP\JSON is deprecated since version 8.1 and will run into the 3 year deprecation time soon. With the upcoming Nextcloud 14 this will not be available anymore. We highly encourage you to move over from those manual checks in the files in ajax/ to the AppFramework way of writing methods. This then takes care of all the checks that are provided by OCP\JSON out of the box. If you need help with the migration please reach out to us. The AppFramework was introduced in version 7.

The removal PR: nextcloud/server#8943
A PR that shows how to move from the ajax/ files to AppFramework: nextcloud/server#8800

Update Only 1 column

DB: Mariadb
I'm using a view as user table to "merge":

  • nextcloud data (quota, password, ...)
  • standard user data (uid, display name, mail, ...)

Users and groups load works great.
But password cache (and maybe quota or display) fails because nextcloud try to update all columns and views with join doesn't support it.

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE nextcloud_users_view SET password = :password, display_name = :name, mail = :email, quota = :quota WHERE uid = :uid' with params ["xxx", "xxx, "xxx", "xxx", "xxx"]: SQLSTATE[HY000]: General error: 1393 Can not modify more than one base table through a join view 'auth.nextcloud_users_view'

It's possible/plained to limit updates to "really updated field" like UPDATE nextcloud_users_view SET password = :password WHERE uid = :uid ?

ps: sorry for my poor english.

Can't get login to work with Wordpress

Hello there,
I just recently found your awesome app and after successfully connecting my wordpress database and table, I was able to view all the users in the list.
Unfortunately despite testing all the encryption methods I wasn't able to log in with my Wordpress user.
I am using the most recent version 3.1.0 for Nextcloud 13.
Any known issues you are aware about or things I should take a look at to make it work?
Kind regards!

Can't authenticate after updating to 4.0

I get the following error in the log:

hash_equals(): Expected user_string to be a string, null given at /var/www/nextcloud/apps/user_sql/lib/Crypto/Phpass.php#55

Table configuration like here: #68 (comment)

Hash algorithm is phpass for a joomla installation.

Add support for salt in SHA512 Whirlpool?

I have an external php website (HubZilla) that creates salted whirlpool hashes like this:

$salt = random_string(32);
$password_encoded = hash('whirlpool', $salt . $password);

Which I assume is the Whirlpool of this app? However it is clearly salted, which seems to be not supported? I tried and so far it fails sadly.

Would be much appreciated if the option to salt the Whirlpool hash would be added. Thanks!

vbulletin users and nextcloud

Hello, i have vbulletin 4 and nextcloud 13
i installed sql user backend
users are appear in nextcloud but cant auth in nextcloud.

Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.