-
Notifications
You must be signed in to change notification settings - Fork 259
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
any libpam-gocryptfs #34
Comments
Could this be an alternative to pam triggered mounts? |
@guedressel I don't know, I think the point of doing it in PAM is that you can get a password from the user. @jsalatiel There is no PAM module written specifically for gocryptfs, but I think this should be possible with pam-mount. If you find out how to do it i'd be happy to add it to the gocryptfs documentation. |
@rfjakob, couldn't you extend the libpam-encfs to support gocrypt ? or copy it changing what needs to be changed. ( i think it is gpl ) |
from what i see, if gocryptfs supports password from stdin ( -S ) , libpam-encfs would work just fine if i rename "gocryptfs" to "encfs" |
@rfjakob, would it be possible to add support to fuse "alow-root" and "nonempty" ? |
You can use the |
@rfjakob , when trying to automount using a customized pam_encfs or even pam_mount it will never mount because of the damn .cache folder in home directory. I dont know who create this folder, but even if i delete, it will be recreated before the gocryptfs mount the actual directory, so it will fail. It would be nice if you could accept the extra fuse parameters like encfs. About the allow_other, i would prefer allow_root because its safer for non IT users. |
Haha, the cache directory, I see. Will add a nonempty option. allow_root is for the xauthority file? |
allow_root is also for the xauthority. =) |
@rfjakob if you can make gocryptfs work like encfs concerning mounting parameters, gocryptfs will work with pam_mount fuse without no changes to the pam_mount code.
This is the call that pam_mount make to mount fuse directories. |
I think this command line fails because of two issues:
For now I'd recommend to:
And once I have it implemented, add the "-nonempty" option |
Apparently the -o is mandatory to pass fuse options to command line, and gocrypt wont allow the '-o' and even require parameters to be set before the paths.
|
gocryptfs -allow_other /tmp/a /tmp/b
|
@rfjakob i understant that this way it will work. What i mean is that using options before the paths will force changes to the source code of pam_mount to allow support for gocrypt. By default, pam_mount support fuse type and internally will call #mount.fuse EXECUTABLE#SOURCE DST -o FUSE_OPTIONS anyway, i only say that it would be easier to change gocryptfs to support the 'generic fuse mounter' of pam_mount than the other way around. but i will be very happy with the nonempty option because i can change the pam_encfs to work with this. |
Ah ok now i get it! Using pam_mount as-is would be nice.
Can you share the config to get it to call gocryptfs? Will take a look in
the evening.
|
When i get home i will send you. I am on GMT-3, so maybe you can only see it tomorrow! Whats your TZ ? |
enable debug with:
and add in volume definitions:
and this is the requirement for home mounting =) |
I didn't get very far, but, I found out that you can set the mount command line using
This solves the parameter order problem, which is difficult to solve otherwise, because Flag parsing stops just before the first non-flag argument. In other words, options must precede other arguments with the default Go cli parser. So gocryptfs seems to be called with the right command line, but then on my Fedora 24 machine things exploded into a torrent of SELinux errors and the login with testuser hangs. That's all for today, good night ;) I'm at GMT+2. |
About the noroot=1 , it is not needed when using type 'fuse' Change the lclmount option will break all other mount entries of pam_mount. |
An alternative is to use a bash wrapper script that reorders the command
line parameters
|
Please implement the nonempty option and i will find a way to make it work. |
Option added as |
how can i download it ? Sorry, i only know how to download from releases =) |
Oh I see, no problem, here is the binary: gocryptfs_v1.1-beta1-22-g45dfc90_fedora24_amd64.tar.gz |
Hi @rfjakob , well , first i am trying to make it work with pam_encfs module. It works fine in ubuntu/mint but it fails strangely on CentOS. In CentOS the directory gets mounted and appear in /proc/mounts, but the gocryptfs daemon is not running so i get the transport endpoint not connected error. |
When forking into the background, gocryptfs used to keed stdout and stderr open. This is helpful to see panics, but if they are connected to another program that exits, this kills gocryptfs. So I close them now proactively: gocryptfs_v1.1-beta1-24-g14fd5ce_fedora24_amd64.tar.gz |
Well, it did not work. Now i am gonna try to figure it out a way to make it work with pam_mount ! |
I really miss the days when linux were all the same. Well, i was able to make pam_mount work with CentOS just fine. I created a little wrapper to mount it. Well, here it is for those who prefer redhat like distros. |
Just to make it clear, use pam_gc if you are on ubuntu derivatives, or pam_mount if you are on redhat derivatives. @rfjakob , thank you for your help ! I'd like to help more, but i just cant figure it out whats happening. |
Oh. That's a bug. Give me a second.... |
Fixed in dc4fdd8 , sorry about that! |
It worked, i will post the pam changes for mint/ubuntu soon. testuser 24220 0.6 0.9 205168 74352 ? Sl 18:55 0:00 ./gocryptfs -f -notifypid=24213 -nonempty -allow_other /home/testuser.cipher /home/testuser |
Hmm, I thought pam_mount checks for that. I will take a look at the pam_mount source code. |
Fixed in a985096. gocryptfs_pam_mount.bash now checks for an existing mount. The check in pam_mount does not seem to be working for FUSE. |
Almost perfect. Just do not echo 'something is already mounted on /home/testuser, refusing' when quiet option is set, and exit with '0' , otherwise every new session pam_mount will show this message even with debug disabled: |
I have integrated the functionality of The bash wrapper should be no longer needed and I have removed it. |
Hi @rfjakob , nice idea!
I think the defaults are different, since i am not passing those options. See my pam_mount file:
btw, please remember ( if you agree) that we can use "*" as user in pam_mount, so it would be really nice the following behaviour if quiet options is set:
This ensures that in a multi user environment , users that do not use gocryptfs wont get cryptic errors about gocrypfs, but still allowing those users who want use it , create the cipher dir and encrypt their directories ! I hope you understand what i mean. |
I made a few edits to the last two sentences. ( sorry the english ) |
Yeah, you need "nodev,nosuid" otherwise mount adds "dev" and "suid".
Need to think about the quiet thing. But isn't there a per-user pam mount
config?
|
I know there is per-user pam mount config and it is pŕetty usable to my home computer, but if you think about small offices or even big offices , it is not safe at all and should not be allowed. ( i am thinking gocryptfs going big =] ) |
I'd rather have this as an external script, this should be quite easy to in bash. Maybe something like this (lightly tested): https://gist.github.com/rfjakob/d11d4a1085516fe1d70c3b7ce447d556 |
Perfectly! I agree =) |
thanks! |
This patch to pam_mount may also be helpful to you. Among other things, it eliminates the |
Am I reading this right, pam_mount was creating an xml file in the mountpoint? Wtf. |
The xml file in the home directory ( Such a place for unencrypted user data may also also be usefule for ssh's |
Hi @rfjakob , i can not tell exactly when it happened, but i tried to compile from git today and the binary wont automount using pam_mount. After try to login, the terminal hangs and it does not show the shell prompt. If i use the binary that i compiled from git on april 24 it works just fine. Any big change that could affect the automount ? |
I tried to reproduce right now and it seemed to hang here as well. No idea yet what caused it, will investigate tonight. |
@jsalatiel should be fixed in master by commit 496968e . Can you confirm? |
It is working. Thanks ! |
I think the original issue title still stands. Without a libpam-gocryptfs, it's impossible to update the gocryptfs password when the user changes his / her login password. In a PAM world it would be done in response to the the /**
* pam_sm_setcred -
* @pamh: PAM handle
* @flags: PAM flags
* @argc: number of elements in @argv
* @argv: NULL-terminated argument vector
*
* This is a placeholder function so PAM does not get mad.
*/
PAM_EXTERN EXPORT_SYMBOL int pam_sm_setcred(pam_handle_t *pamh, int flags,
int argc, const char **argv)
{
return PAM_SUCCESS;
} Not dramatic, but I wanted to put it out there that libpam-gocryptfs could exist in its own right to do something that pam_mount on its own can't. Maybe pam_mount will eventually provide config hooks to propagate the callback to a user configurable command, but I would not hold my breath for it to happen anytime soon. |
Good point, thanks |
Is there any pam module to automount after login just like libpam-encfs ?
The text was updated successfully, but these errors were encountered: