-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMB/CIFS mounts using ownCloud login, fixes #7843 #7875
SMB/CIFS mounts using ownCloud login, fixes #7843 #7875
Conversation
The admin interface shows the external storage to be invalid since it wont be able to check if the storage is valid without login in to cache the credentials, this check will need to be overwritten. Besides that everything seems to work |
Hmm, how should that be implemented? I could override the check to always return success, but perhaps extending the current status mechanism to include a yellow 'unknown' symbol might be the best solution? |
Maybe only check if the hostname provided is valid |
🚀 Test Passed. 🚀 |
Another "problem" here is that the password is always stored in the session regardless whether any ext storage is used. You only need to enable the app and then the password will be stored. I know you copied this from iROdS, I never realized that it worked that way... (CC @LukasReschke) |
Is that an issue? All communication between a client and the server is over HTTPS, and we assume the browser is secure, so there is little to no security risk with this surely? |
Storing the password in the sessions which may get stored on the local file system is a bad idea. This basically makes ownCloud "one service to pwn them all" (especially in LDAP environments), if an attacker gains access to the sessions he has access to the clear text passwords of every user... This is not really what a normal user or sysadmin would expect. I do understand the need for such "SSO" setups. And I think that there is not a secure solution at all. Therefore I'd like to suggest one of the following two approaches:
I think 2 may be a better approach as it allows ownCloud to access the mountpoint even if the user is not logged in (e.g. for some occ commands) In both cases when clicking the "use the same login" checkbox a warning should get shown to the user/admin explaining that this requires ownCloud to store the password in plaintext and in case of a security vulnerability an attacker may be able to gain access to the ownCloud password. Any other suggestions? |
And as Vincent said: The password should only get stored if a mountpoint requires it. |
Question is, should this be fixed separately ? Because that's what happens for iRODS. |
Yeah. This would be a good idea. |
Caching the password in the mounts config could also provide a partial solution to the sharing problem. |
One idea would be to modify the login hook and make it go through the "Config" class. That class could then check whether there is a mount for SMB_OC or iRODS and then store the password into its config (if it has the "use ownCloud login" flag set). |
Ok maybe not iRODS yet as it might not work, we can do that later separately. |
Well that's the checks part complete. Tested here, seems to work, please review.
EDIT: Ignore me, that seems to be a bug of my modified code. |
🚀 Test Passed. 🚀 |
🚀 Test Passed. 🚀 |
@Xenopathic you might not need the option "username as share", there is an obscure hidden feature in the code where "$user" gets replaced by the current user, see owncloud-archive/documentation#307 But keeping it is good for visibility / UX |
Going to test this:
|
One test failed. Note that I've used a "root" value for all shares. TODO:
|
|
The system wide tests without root work fine for me. I will see what is wrong with a non-empty root, and a custom share name. RE the separate PR for password storage - should it reference the iRODS credential mechanism, or wait until this PR goes through so that it can reference both? |
As you like. |
Hmm, custom share name with root is working fine here. |
Wait... I think I see. Of course the user "root" doesn't have smb access. Trying with the correct user now. |
Never mind, it works. It was just a misunderstanding. |
Please rebase this and then I think it's good to go 👍 @icewind1991 second review? |
Selecting 'SMB/CIFS Auto' in the mounts configuration allows an SMB/CIFS mount to be configured that uses the credentials of the user logging in to authenticate to the server. Optionally, the username can be used as the share name, permitting home shares to be dynamically mounted.
getDisplayName would return the display name of the user, not great if it is a canonical string. The uid passed back from 'login' is the UUID of the user, so also not suitable. The login name from the session is the username the user used to log in to ownCloud in the first place, which is what is needed.
Shares authenticated with user credentials (aka not hard coded) cannot be accessed by other users, breaking sharing. This change completely revokes sharing for such shares
SMB_Auto is now SMB_OC, and the name has been changed from "SMB / CIFS Auto" to "SMB / CIFS using OC login"
To check for shares, the code attempts to connect anonymously to the share. In most cases this will fail with NT_STATUS_ACCESS_DENIED, so the regex array used for parsing the output of smbclient in smb4php has been overridden to treat such output as success. The 'test' method for storage classes can now take a single parameter, $isPersonal, which allows the storage to adjust the tests performed based on if they are being configured as personal shares or as system shares.
Rebase complete |
|
||
public function test($isPersonal = true) { | ||
if ($isPersonal) { | ||
if ($this->stat('')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use {}
It still shows the mount as invalid in the admin panel for me |
A new inspection was created. |
@icewind1991 Can you post the details of the configuration? And if you try to run:
What error do you get? You should get an |
🚀 Test Passed. 🚀 |
🚀 Test Passed. 🚀 |
@icewind1991 did you pull ? What combination of settings did you use ? |
Never mind, the problem was that I didn't do a login after checking out the branch, works for me now after a re-login. 👍 |
SMB/CIFS mounts using ownCloud login, fixes #7843
@Xenopathic do you want to take care of the "only store password when mount point is used" part as a separate PR ? (with the details I suggested here #7875 (comment)) Edit: missing word |
@PVince81 Sure, I'll get on it. |
Excellent. Thanks a lot for your contributions 😄 |
Hi, did this patch find its way in the official branch? When would it be available in the official version? |
It will be included in our next major release: ownCloud 7. |
Thanks! Cool, can't wait for it ... will retry my experiments then. |
This PR provides a new mount type, that uses the user's ownCloud login credentials to connect to the SMB/CIFS share. It also has the ability to use the username as the share name, for use with home shares. The username and password are stored as session variables, however I do not consider this a security risk as iRODS already does the same thing.
Fixes #7843
Please review @blizzz @PVince81 @icewind1991 @DeepDiver1975