_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Amit Gud wrote:
>
> AG
>
>------------------------------------------------------------------------
>
>If the 'user' or 'users' mount option is specified on commandline, verify with
>/etc/fstab if it is really specified. Setuid bit is still ON and should remain
>ON since mount drops the root privileges.
>
>I've given this patch a good hammering, but not exhaustive by any means.
>
>Signed-off-by: Amit Gud <[email protected]>
>Signed-off-by: Steve Dickson <[email protected]>
>
>---
>
>
>diff -uprN -X ../dontdiff nfs-utils/utils/mount/mount.c nfs-utils-ag/utils/mount/mount.c
>--- nfs-utils/utils/mount/mount.c 2006-07-25 11:07:14.000000000 -0400
>+++ nfs-utils-ag/utils/mount/mount.c 2006-07-28 10:19:54.000000000 -0400
>@@ -355,9 +433,33 @@ int main(int argc, char *argv[])
>
> spec = argv[1];
> mount_point = canonicalize(argv[2]);
>-
>+
> parse_opts(mount_opts, &flags, &extra_opts);
>
>+ if (uid != 0 && !(flags & MS_USERS) && !(flags & MS_USER)) {
>+ fprintf(stderr, "%s: permission denied\n", progname);
>+ exit(1);
>+ }
>+
>+ if ((flags & MS_USER || flags & MS_USERS) && uid != 0) {
>+ /* check if fstab has entry, and further see if the user or users option is given */
>+ if ((mc = getfsspec(spec)) == NULL &&
>+ (mc = getfsfile(spec)) == NULL) {
>+ fprintf(stderr, "%s: permission denied - invalid option\n", progname);
>+ exit(1);
>+ }
>+ else {
>+ if((flags & MS_USER) && !contains(mc->m.mnt_opts, "user")) {
>+ fprintf(stderr, "%s: permission denied - invalid option\n", progname);
>+ exit(1);
>+ }
>+ if((flags & MS_USERS) && !contains(mc->m.mnt_opts, "users")) {
>+ fprintf(stderr, "%s: permission denied - invalid option\n", progname);
>+ exit(1);
>+ }
>+ }
>+ }
>+
> if (!strcmp(progname, "mount.nfs4") || nfs_mount_vers == 4) {
> nfs_mount_vers = 4;
> mnt_err = nfs4mount(spec, mount_point, &flags, &extra_opts, &mount_opts, 0);
>
>
It seems to me that these two "permission denied" messages may be somewhat
less than completely helpful. Would it be possible to be a little more
explicit about why permission was being denied?
Thanx...
ps
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Peter Staubach wrote:
>
> It seems to me that these two "permission denied" messages may be somewhat
> less than completely helpful. Would it be possible to be a little more
> explicit about why permission was being denied?
>
Yes possible. I was thinking of not letting the users know which user
mounted the export, but that is known by mount command anyways. So, yes
these messages could be more elaborate :)
AG
--
May the source be with you.
http://www.cis.ksu.edu/~gud
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
On Friday July 28, [email protected] wrote:
Sorry for the delay in reviewing this.
>
> If the 'user' or 'users' mount option is specified on commandline, verify with
> /etc/fstab if it is really specified. Setuid bit is still ON and should remain
> ON since mount drops the root privileges.
>
> I've given this patch a good hammering, but not exhaustive by any means.
I still don't see this as being adequately secure.
All you are checking is whether the user has permission to mount onto
the given directory, or from the given server:/directory, but not if
they are allow to mount that server on that directory, or what options
are required.
e.g. /etc/fstab could say you are only allowed to mount with
noexec,nosuid, but mount.nfs isn't enforcing that.
It seems to me that if getuid() returns non-zero, then you have to
either ignore or check everything given on the command line.
i.e.
find the entry in /etc/fstab which has the same mointpoint and the
same 'special' (server:/path).
Make sure the options in /etc/fstab have an appropriate user or
users entry.
Use the options from /etc/fstab and ignore the options on the
command line.
Does that sound fair?
NeilBrown
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs