From owner-freebsd-fs@FreeBSD.ORG Sun May 20 23:22:44 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA22916A421 for ; Sun, 20 May 2007 23:22:44 +0000 (UTC) (envelope-from SRS0=AAamUv=KV=vvelox.net=v.velox@yourhostingaccount.com) Received: from mailout12.yourhostingaccount.com (mailout12.yourhostingaccount.com [65.254.253.98]) by mx1.freebsd.org (Postfix) with ESMTP id 8480013C458 for ; Sun, 20 May 2007 23:22:44 +0000 (UTC) (envelope-from SRS0=AAamUv=KV=vvelox.net=v.velox@yourhostingaccount.com) Received: from mailscan41.yourhostingaccount.com ([10.1.15.41] helo=mailscan41.yourhostingaccount.com) by mailout12.yourhostingaccount.com with esmtp (Exim) id 1HpujZ-0001JI-Je for freebsd-fs@freebsd.org; Sun, 20 May 2007 19:22:41 -0400 Received: from authsmtp10.yourhostingaccount.com ([10.1.18.10] ident=exim) by mailscan41.yourhostingaccount.com with spamscanlookuphost (Exim) id 1HpujZ-0007Pg-Gs for freebsd-fs@freebsd.org; Sun, 20 May 2007 19:22:41 -0400 Received: from authsmtp10.yourhostingaccount.com ([10.1.18.10] helo=authsmtp10.yourhostingaccount.com) by mailscan41.yourhostingaccount.com with esmtp (Exim) id 1HpujY-0007PO-6V; Sun, 20 May 2007 19:22:40 -0400 Received: from cpe-65-185-51-114.columbus.res.rr.com ([65.185.51.114] helo=vixen42) by authsmtp10.yourhostingaccount.com with esmtpa (Exim) id 1HpujX-00026u-QS; Sun, 20 May 2007 19:22:40 -0400 Date: Sun, 20 May 2007 19:25:11 -0400 From: "Zane C.B." To: Hiroharu Tamaru Message-ID: <20070520192511.7ea7188a@vixen42> In-Reply-To: References: <20070519222527.680ba5c2@vixen42> <20070520123607.4aba7f35@vixen42> <20070520131042.2ce78ae0@vixen42> <20070520134645.3d77b75c@vixen42> X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.12; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-EN-UserInfo: 0d1ca1697cdb7a831d4877828571b7ab:1570f0de6936c69fef9e164fffc541bc X-EN-AuthUser: vvelox2 Sender: "Zane C.B." X-EN-OrigIP: 65.185.51.114 X-EN-OrigHost: cpe-65-185-51-114.columbus.res.rr.com Cc: freebsd-fs@freebsd.org Subject: Re: mount_smbfs and non-interactively passing a password to it X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2007 23:22:45 -0000 On Mon, 21 May 2007 03:22:46 +0900 Hiroharu Tamaru wrote: > At Sun, 20 May 2007 13:46:45 -0400, > Zane C.B. wrote: > > > > On Mon, 21 May 2007 02:39:17 +0900 > > Hiroharu Tamaru wrote: > > > > > At Sun, 20 May 2007 13:10:42 -0400, Zane C.B. wrote: > > > > > > > > On Mon, 21 May 2007 01:58:58 +0900 > > > > Hiroharu Tamaru wrote: > > > > > > > > > At Sun, 20 May 2007 12:36:07 -0400, Zane C.B. wrote: > > > > > > > > > > > > On Mon, 21 May 2007 01:19:58 +0900 > > > > > > Hiroharu Tamaru wrote: > > > > > > > > > > > > > > > > > > > > At Sat, 19 May 2007 22:25:27 -0400, Zane C.B. wrote: > > > > > > > > Is passing a password to mount_smbfs non-interactively > > > > > > > > possible? I know it can't accept it on STDIN by > > > > > > > > piping it into it. > > > > > > > > > > > > > > mount_smbfs(8) : > > > > > > > -N Do not ask for a password. At run time, > > > > > > > mount_smbfs reads the ~/.nsmbrc file for additional > > > > > > > configuration parameters and a password. If no > > > > > > > password is found, mount_smbfs prompts for it. > > > > > > > > > > > > > > /usr/share/examples/smbfs/dot.nsmbrc : > > > > > > > [FSERVER:JOE] > > > > > > > # use persistent password cache for user 'joe' > > > > > > > password=$$1767877DF > > > > > > > > > > > > > > I'm using -N for shares w/o passwords; I've never > > > > > > > tried .nsmbrc password myself > > > > > > > > > > > > This is not useful if ~/ is not mounted and you are > > > > > > planning of mounting it using mount_smbfs. > > > > > > > > > > You never said that. > > > > > Who's mounting ~user in that case? root? > > > > > > > > Yeah, looking at doing it through PAM. > > > > > > OK. finally, I see your picture and why you said ENV; > > > > > > For a hack: > > > With the root creds in effect, /root/.nsmbrc is consulted > > > and /etc/nsmb.conf is always consulted (as written in that > > > file). Write the password in either of it, mount, and wipe it > > > out. > > > > Not useful since that would require passwords being in that file. > > Yeah, I well see that the password lives longer if a file is > used (even if you symlink it onto a memory file system), but > root can always peek inside the memory as well, and root can > often intercept syscalls as well. > Anyway, that's why I called it a hack. > > > > Other than that, I've no idea. > > > You'd need to wipe out the environment vars if you use it too. > > > > Decided against that since D.E.S. pointed out that it would be > > exposed in /proc. > > Yeah, I thought it'd be tough too. > > If you are going to modify mount_smbfs anyway, you could > give it a pipe or a socket as an ARG or ENV, or have it > unnamed and inherit it? The password is then send via the > pipe or the socket. Doing it as a ARG would be very unsecure and as a ENV unsecure if procfs is in use. I created a patch for pam_exec, but D.E.S. pointed out the procfs issue to me. > FWIW, IIRC, some version of ssh-agent used unnamed socket or > pipe to limit its access to its descendants only. I don't > know if the reason for the change of that enforcement was > security-wise or not. Yeah, going to have to look at that and expand my C skills some more.