* SSH URL
@ 2014-03-29 19:40 Esben Stien
2014-03-30 2:51 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Esben Stien @ 2014-03-29 19:40 UTC (permalink / raw)
To: help-gnu-emacs
In Emacs, I usually open ssh sessions like this:
cd /ssh:foo@baz:~
Is there any way in Emacs to open up SSH URLs', like this?:
ssh://foo:bar@baz
Here's the password included and this is the way I receive SSH urls.
I understand the security aspects of this but I don't care about that
with this project. I use PKI normally, though.
I use the following python script that accepts SSH urls, but I'd rather
use my beloved emacs.
#!/usr/bin/env python
import pexpect
import struct, fcntl, os, sys, signal
import urlparse
def sigwinch_passthrough (sig, data):
# Check for buggy platforms (see pexpect.setwinsize()).
if 'TIOCGWINSZ' in dir(termios):
TIOCGWINSZ = termios.TIOCGWINSZ
else:
TIOCGWINSZ = 1074295912 # assume
s = struct.pack ("HHHH", 0, 0, 0, 0)
a = struct.unpack ('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ , s))
global global_pexpect_instance
global_pexpect_instance.setwinsize(a[0],a[1])
url = urlparse.urlparse(sys.argv[1]);
ssh_newkey = 'Are you sure you want to continue connecting'
p=pexpect.spawn('ssh'+' '+url.username+':'+url.password+'@'+url.hostname)
i=p.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT],1)
if i==0:
print "I say yes"
p.sendline('yes')
i=p.expect([ssh_newkey,'password:',pexpect.EOF])
if i==1:
#print "I give password",
p.sendline(url.password)
elif i==2:
print "I either got key or connection timeout"
pass
elif i==3: #timeout
pass
p.sendline("\r")
global global_pexpect_instance
global_pexpect_instance = p
signal.signal(signal.SIGWINCH, sigwinch_passthrough)
try:
p.interact()
sys.exit(0)
except:
sys.exit(1)
--
Esben Stien is b0ef@e s a
http://www. s t n m
irc://irc. b - i . e/%23contact
sip:b0ef@ e e
jid:b0ef@ n n
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-29 19:40 SSH URL Esben Stien
@ 2014-03-30 2:51 ` Stefan Monnier
2014-03-30 17:48 ` Michael Albinus
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2014-03-30 2:51 UTC (permalink / raw)
To: help-gnu-emacs
> In Emacs, I usually open ssh sessions like this:
> cd /ssh:foo@baz:~
> Is there any way in Emacs to open up SSH URLs', like this?:
> ssh://foo:bar@baz
It should not be terribly hard to add support for the ssh protocol to
the URL library and to the url-handlers.el (using Tramp underneath,
obviously).
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-30 2:51 ` Stefan Monnier
@ 2014-03-30 17:48 ` Michael Albinus
2014-03-30 18:41 ` Stefan Monnier
2014-03-31 18:45 ` Esben Stien
0 siblings, 2 replies; 9+ messages in thread
From: Michael Albinus @ 2014-03-30 17:48 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> In Emacs, I usually open ssh sessions like this:
>> cd /ssh:foo@baz:~
>> Is there any way in Emacs to open up SSH URLs', like this?:
>> ssh://foo:bar@baz
>
> It should not be terribly hard to add support for the ssh protocol to
> the URL library and to the url-handlers.el (using Tramp underneath,
> obviously).
Tramp has denied to add passwords to the file name syntax so far, for
security reasons. I don't believe that I would like to change this policy.
But one could use other means, like password-cache or an own backend for
auth-sources. Both would be transparent to Tramp.
Tramp did support URL file name syntax until Sep 2013. It was dropped
then due to lack of interest ...
I'm undecided yet, but maybe I could start to reenable this, starting
from url-handlers.el. However, this package is dav-centric; I don't know
what it does take to generalize it.
And I would need more encouragement from other people, given that
Tramp's URL implementation was completely ignored ...
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-30 17:48 ` Michael Albinus
@ 2014-03-30 18:41 ` Stefan Monnier
2014-03-30 19:26 ` Michael Albinus
2014-04-01 12:57 ` Michael Albinus
2014-03-31 18:45 ` Esben Stien
1 sibling, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-03-30 18:41 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
> Tramp has denied to add passwords to the file name syntax so far, for
> security reasons. I don't believe that I would like to change this policy.
Agreed. My suggestion was only to change url-handlers.el (and probably
add a url-ssh.el), not to change Tramp.
> And I would need more encouragement from other people, given that
> Tramp's URL implementation was completely ignored ...
AFAIK this "ssh://" syntax is not standardized (E.g. Bazaar uses
"bzr+ssh://"), which is probably a good reason why it's not very
popular.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-30 18:41 ` Stefan Monnier
@ 2014-03-30 19:26 ` Michael Albinus
2014-04-01 12:57 ` Michael Albinus
1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2014-03-30 19:26 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>> And I would need more encouragement from other people, given that
>> Tramp's URL implementation was completely ignored ...
>
> AFAIK this "ssh://" syntax is not standardized (E.g. Bazaar uses
> "bzr+ssh://"), which is probably a good reason why it's not very
> popular.
The IETF documents a draft at least,
<http://tools.ietf.org/html/draft-ietf-secsh-scp-sftp-ssh-uri-04>. It
hasn't found its way into an accepted rfc (AFAIK), but we could use it.
IANA documents it as known scheme, <https://www.iana.org/assignments/uri-schemes/prov/ssh>.
Other connection methods, supported by Tramp, are accepted as rfc, like
ftp, telnet (RFC 3986), or rsync (RFC 5781).
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-30 17:48 ` Michael Albinus
2014-03-30 18:41 ` Stefan Monnier
@ 2014-03-31 18:45 ` Esben Stien
2014-04-01 6:38 ` Michael Albinus
1 sibling, 1 reply; 9+ messages in thread
From: Esben Stien @ 2014-03-31 18:45 UTC (permalink / raw)
To: help-gnu-emacs
Michael Albinus <michael.albinus@gmx.de> writes:
> Tramp has denied to add passwords to the file name syntax so far, for
> security reasons. I don't believe that I would like to change this policy.
Is there any way I could get around this?
I have a specific use case where this would save me lots of time and the
security aspects are nothing I worry about.
These are ssh urls to restricted accounts for websites.
I basically want to just follow the url and be logged into the site, do
my thing and get out.
--
Esben Stien is b0ef@e s a
http://www. s t n m
irc://irc. b - i . e/%23contact
sip:b0ef@ e e
jid:b0ef@ n n
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-31 18:45 ` Esben Stien
@ 2014-04-01 6:38 ` Michael Albinus
0 siblings, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2014-04-01 6:38 UTC (permalink / raw)
To: Esben Stien; +Cc: help-gnu-emacs
Esben Stien <b0ef@esben-stien.name> writes:
>> Tramp has denied to add passwords to the file name syntax so far, for
>> security reasons. I don't believe that I would like to change this policy.
>
> Is there any way I could get around this?
Yesterday, during a boring hour, I've added some glue code to
url-handlers.el. Didn't look bad, when I've tested in *scratch*
(progn
(url-handler-mode 1)
(insert-directory "ssh:///" "-al" nil 'full))
For the password thing, you could use Tramp's password caching
mechanism. Or you could add an entry to .authinfo; Tramp uses
auth-source.el if appropriate.
> I have a specific use case where this would save me lots of time and the
> security aspects are nothing I worry about.
>
> These are ssh urls to restricted accounts for websites.
>
> I basically want to just follow the url and be logged into the site, do
> my thing and get out.
I have no idea what you mean with this. Could you give me an example of
what you're doing, usually?
Best regards, Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-03-30 18:41 ` Stefan Monnier
2014-03-30 19:26 ` Michael Albinus
@ 2014-04-01 12:57 ` Michael Albinus
2014-04-01 14:29 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Michael Albinus @ 2014-04-01 12:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> Agreed. My suggestion was only to change url-handlers.el (and probably
> add a url-ssh.el), not to change Tramp.
I've added url-tramp.el to the trunk, plus changes in
url-handlers.el. Works pretty well for simple cases, but needs more
massage for primitives returning complex objects, like
(directory-files "scp:///tmp" 'full)
I'll continue to work on it. Maybe it will be possible to enhance the
tests in tramp-tests.el for this url-like syntax, this would help to
finish the work.
> Stefan
Best regards, Michael.
PS: Starting tomorrow morning, I'll be on the road. Don't expect me to
react before weekend.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: SSH URL
2014-04-01 12:57 ` Michael Albinus
@ 2014-04-01 14:29 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-04-01 14:29 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
> I've added url-tramp.el to the trunk, plus changes in
> url-handlers.el. Works pretty well for simple cases, but needs more
> massage for primitives returning complex objects, like
> (directory-files "scp:///tmp" 'full)
Cool, thanks,
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-04-01 14:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29 19:40 SSH URL Esben Stien
2014-03-30 2:51 ` Stefan Monnier
2014-03-30 17:48 ` Michael Albinus
2014-03-30 18:41 ` Stefan Monnier
2014-03-30 19:26 ` Michael Albinus
2014-04-01 12:57 ` Michael Albinus
2014-04-01 14:29 ` Stefan Monnier
2014-03-31 18:45 ` Esben Stien
2014-04-01 6:38 ` Michael Albinus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).