From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
"João Távora" <joaotavora@gmail.com>,
emacs-devel@gnu.org
Subject: Tramp sudoedit method (was: sudo:: method in tramp possible security issue)
Date: Sun, 16 Dec 2018 16:24:26 +0100 [thread overview]
Message-ID: <875zvtcx5h.fsf@gmx.de> (raw)
In-Reply-To: <87ftvwyxh7.fsf@gmx.de> (Michael Albinus's message of "Tue, 20 Nov 2018 09:17:08 +0100")
Michael Albinus <michael.albinus@gmx.de> writes:
Hi,
>>> Right, but would it run emacs-lisp code with elevated privileges?
>>> Can't we just make a sudoedit method that just invokes the sudoedit
>>> program or "sudo -e"? This is what I thought sudo:: did in the first place.
>>
>> All of Tramp basically works by starting an `sh` process (via ssh, sudo,
>> you name it) and then sending it commands to retrieve meta-info about
>> files, contents of file, etc...
>
> Right. But maybe we could offer a Tramp method "sudoedit", which behaves
> differently. If somebody opens "C-x C-f /sudoedit::/etc/passwd", Tramp
> starts in the background the process "env EDITOR=emacsclient sudoedit
> /etc/passwd" (plus fiddling with `server-start', password handling, and
> alike). Nothing else but just editing the file, and saving it, would be
> possible.
>
> Don't know what it means for implementation, because visiting a file is
> more than just calling `insert-file-contents'. Handlers for all the
> other magic file operations should return proper results, w/o running a
> shell under root permissions.
I gave it a try. I could make `insert-file-contents' and `write-region'
run based on emacsclient, but it wasn't mature enough. So I have
implemented the "sudoedit" method by applying a respective sudo call for
everything. It isn't using the sudoedit command any longer, but I kept
the method name, because it behaves similar. If it confuses people too
much, we could change the name.
Contrary to the "sudo" method, it is applicable only to the local host,
and it cannot be used in multi-hop methods. Furthermore, it has a worse
performance than "sudo", especially for large directories like "/etc",
visited with `dired'. Maybe this could be improved by a native
implementation of `directory-files-and-attributes' and `insert-directory'.
But it keeps the security promise, not to run a shell in the background
with other user credentials, which could be attacked by malicious code.
Pushed to master. What do people think?
>> Stefan
Best regards, Michael.
prev parent reply other threads:[~2018-12-16 15:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CALDnm52oYOV_kPWZH62ub8seM4uug-GH68ywgXGJfDAbG7_4Xg@mail.gmail.com>
[not found] ` <87ftvwdcdw.fsf@gmx.de>
[not found] ` <CALDnm51fhzD48-40-t04KU9S19Lz8_sf8Y=pKZbnSHR+tbCgTQ@mail.gmail.com>
[not found] ` <87bm6kdb68.fsf@gmx.de>
[not found] ` <CALDnm53tX4vFz4CH=P27_dUt=9dXWMrE7xdTz3iZuqybsndygg@mail.gmail.com>
[not found] ` <jwvmuq4zqsz.fsf-monnier+emacs@gnu.org>
[not found] ` <CALDnm52moQthtMvSEw2ELWjZg3yJ8jypG=TBLgSsdr6R8ru0Aw@mail.gmail.com>
[not found] ` <87bm6kyxc3.fsf@gmx.de>
[not found] ` <CALDnm5211UDT_pW-HzgnRb5dQtnCZSgN+GRGHYM1hPVAjBWavA@mail.gmail.com>
[not found] ` <87k1l83yd3.fsf@gmx.de>
[not found] ` <CALDnm52KU0wNd3Sd-7m78JrPcLsiNuZ8hQxcTs3PgDNG7+0a0g@mail.gmail.com>
[not found] ` <87o9ajvost.fsf@gmx.de>
2018-11-20 14:13 ` sudo:: method in tramp possible security issue João Távora
2018-11-20 21:14 ` Paul Eggert
2018-11-20 21:18 ` Stefan Monnier
2018-11-20 21:25 ` Paul Eggert
2018-11-20 21:44 ` Stefan Monnier
2018-11-20 22:06 ` Michael Albinus
2018-11-20 22:27 ` João Távora
2018-11-20 23:12 ` Stefan Monnier
2018-11-21 7:41 ` Michael Albinus
2018-11-21 12:26 ` Michael Albinus
2018-11-21 12:44 ` Filipp Gunbin
2018-11-21 12:51 ` Michael Albinus
2018-11-21 14:44 ` John Shahid
2018-11-21 14:52 ` Michael Albinus
2018-11-21 14:55 ` John Shahid
2018-11-21 15:07 ` Michael Albinus
2018-11-20 22:16 ` Michael Albinus
2018-11-20 22:30 ` Michael Albinus
2018-11-20 22:54 ` João Távora
2018-11-21 7:49 ` Michael Albinus
[not found] ` <87ftvwyxh7.fsf@gmx.de>
2018-12-16 15:24 ` Michael Albinus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875zvtcx5h.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=joaotavora@gmail.com \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.