Re: What are port requirements for remote lisp?

Mirko Vukovic <[email protected]> Wed, 1 Apr 2020 08:59:30 -0400
Newsgroups gmane.lisp.slime.devel
Message-ID <CAO73BAD9U7SyvS+9W9ZMVtV0umZpYNiwctQQBAbt0nfVXgd8Uw@mail.gmail.com>
--00000000000073474f05a23a4347
Content-Type: text/plain; charset="UTF-8"

On Tue, Mar 31, 2020 at 11:51 AM Martin Simmons <[email protected]>
wrote:

> >>>>> On Mon, 30 Mar 2020 21:16:00 -0400, Mirko Vukovic said:
> >
> > Hello,
> >
> > My setup is Sly on Spacemacs with Windows 10 running remote lisp on Linux
> > over a corporate network. I have not found a Sly mailing list, and I
> hope I
> > can get an answer here.
> >
> > Emacs is running Sly on Spacemacs on Windows 10. Lisp is running on a
> Linux
> > server. But Sly does not connect to the listening Lisp. Corporate network
> > security policies have changed. I can ask for IT to accommodate me, but
> > first I need to know what to ask for.
> >
> > So far, I have opened a tunnel, and started a listening lisp (details
> > below).
> >
> > In Emacs I get:
> >
> > sly-connect RET RET RET
> > [sly] Connecting to Slynk on port 4005..
> > helm-M-x-execute-command: make client process failed: Connection timed
> out,
> > :name, sly-9, :buffer, nil, :host, hal9000, :service, 4005, :nowait, nil,
> > :tls-parameters, nil
> >
> > The session transcript:
> > > ssh -L4005:localhost:4005 mirko@hal9000
> >
> > [mirko@hal9000 .roswell]$ ros -L ccl-bin run --load
> start-slynk-server.lisp
> >
> >  Added SLYNK path to ASDF:*CENTRAL-REGISTRY*
> > SLYNK's ASDF loader finished.
> >  Loaded ASDF system
> > ;; Slynk started at port: 4005.
> >
> >  Created SLYNK server on port 4005
> >  Set *USE-DEDICATED-OUTPUT-STREAM* to NIL
> > Clozure Common Lisp Version 1.11.5/v1.11.5  (LinuxX8664)
> >
> > For more information about CCL, please see http://ccl.clozure.com.
> >
> > CCL is free software.  It is distributed under the terms of the Apache
> > Licence, Version 2.0.
> > ?
> >
> > My question is as follows:
> >
> >    1. Do I need bi-directional traffic on 4005?
>
> Assuming you are using the ssh tunnel above, then you don't need port 4005
> traffic on the LAN (it is all hidden in the tunnel).
>
> The most likely problem is that some firewall on the Windows machine is
> blocking port 4005.  You may need to configure that firewall to allow ssh
> to
> listen on localhost:4005 and/or to accept connections to it from Spacemacs.
> In theory you might have similar localhost firewall issues on hal9000, but
> that is less likely.
>
>
> >    2. Do I need bi-directional traffic on 22? (after recent changes I
> >    cannot ssh or scp into my Windows machine)
>
> I'm assuming that you ran the ssh command on the Windows 10 machine and it
> gave you a working login to hal9000.  If so, then it looks like you already
> have what you need for port 22.
>

Yes, I can log in to hal9000 with the -L switch:

> ssh -L4005:localhost:4005 mirko@hal9000
Last login: Thu Mar 19 14:33:17 2020 from 172.27.236.189
[mirko@hal9000 ~]$


>
> Note that bi-directional traffic on a connected socket is different from
> whether you can make a connection in both directions.
>
>
> >    3. What tools can I use to try to narrow down the cause of the
> problem?
> >    For instance, can I send a command to the lisp image, and see its
> effects
> >    on the lisp side?
>
> Firstly, run "netstat -antp" on hal9000 to see if Lisp is listening on port
> 4005.
>

It looks that ccl-bin is listening:
$ sudo netstat -antp | grep :4005
tcp        0      0 127.0.0.1:4005          0.0.0.0:*               LISTEN
     104461/lx86cl64


>
> Secondly, run "netstat -anop tcp" on the Windows 10 machine to see if ssh
> is
> listening on port 4005.
>
>
I have Msys2's netstat. On the laptop:
> which netstat
/c/WINDOWS/system32/netstat
/c/Users/mirko/Downloads
> netstat -anop tcp | grep :4005
  TCP    127.0.0.1:4005         0.0.0.0:0              LISTENING       12052


> Thirdly, run "ssh -p 4005 localhost" on the Windows 10 machine.  This use a
> ssh is very bogus, but it should at least give an error message with some
> diagnostics.  (Normally I would use telnet for this, but it is not
> installed
> on Windows 10 by default.)
>

Outputs of both ssh and telnet on the laptop:
> which telnet
/usr/bin/telnet
/c/Users/mirko/Downloads
> telnet localhost 4005
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
/c/Users/mirko/Downloads
> ssh -p 4005 localhost
kex_exchange_identification: read: Connection reset by peer


>
> __Martin
>

Summarizing: of the tests you suggested, all pass but the last one (to ssh
or telnet into port 4005).

Thank you for your assistance so far,

Mirko

--00000000000073474f05a23a4347
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Tue, Mar 31, 2020 at 11:51 AM Martin S=
immons &lt;<a href=3D"mailto:[email protected]">[email protected]</a>=
&gt; wrote:<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">&gt;&gt;&gt;&gt;&gt; On Mon, 30 Mar 2020 21:16:00 -0=
400, Mirko Vukovic said:<br>
&gt; <br>
&gt; Hello,<br>
&gt; <br>
&gt; My setup is Sly on Spacemacs with Windows 10 running remote lisp on Li=
nux<br>
&gt; over a corporate network. I have not found a Sly mailing list, and I h=
ope I<br>
&gt; can get an answer here.<br>
&gt; <br>
&gt; Emacs is running Sly on Spacemacs on Windows 10. Lisp is running on a =
Linux<br>
&gt; server. But Sly does not connect to the listening Lisp. Corporate netw=
ork<br>
&gt; security policies have changed. I can ask for IT to accommodate me, bu=
t<br>
&gt; first I need to know what to ask for.<br>
&gt; <br>
&gt; So far, I have opened a tunnel, and started a listening lisp (details<=
br>
&gt; below).<br>
&gt; <br>
&gt; In Emacs I get:<br>
&gt; <br>
&gt; sly-connect RET RET RET<br>
&gt; [sly] Connecting to Slynk on port 4005..<br>
&gt; helm-M-x-execute-command: make client process failed: Connection timed=
 out,<br>
&gt; :name, sly-9, :buffer, nil, :host, hal9000, :service, 4005, :nowait, n=
il,<br>
&gt; :tls-parameters, nil<br>
&gt; <br>
&gt; The session transcript:<br>
&gt; &gt; ssh -L4005:localhost:4005 mirko@hal9000<br>
&gt; <br>
&gt; [mirko@hal9000 .roswell]$ ros -L ccl-bin run --load start-slynk-server=
.lisp<br>
&gt; <br>
&gt;=C2=A0 Added SLYNK path to ASDF:*CENTRAL-REGISTRY*<br>
&gt; SLYNK&#39;s ASDF loader finished.<br>
&gt;=C2=A0 Loaded ASDF system<br>
&gt; ;; Slynk started at port: 4005.<br>
&gt; <br>
&gt;=C2=A0 Created SLYNK server on port 4005<br>
&gt;=C2=A0 Set *USE-DEDICATED-OUTPUT-STREAM* to NIL<br>
&gt; Clozure Common Lisp Version 1.11.5/v1.11.5=C2=A0 (LinuxX8664)<br>
&gt; <br>
&gt; For more information about CCL, please see <a href=3D"http://ccl.clozu=
re.com" rel=3D"noreferrer" target=3D"_blank">http://ccl.clozure.com</a>.<br=
>
&gt; <br>
&gt; CCL is free software.=C2=A0 It is distributed under the terms of the A=
pache<br>
&gt; Licence, Version 2.0.<br>
&gt; ?<br>
&gt; <br>
&gt; My question is as follows:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 1. Do I need bi-directional traffic on 4005?<br>
<br>
Assuming you are using the ssh tunnel above, then you don&#39;t need port 4=
005<br>
traffic on the LAN (it is all hidden in the tunnel).<br>
<br>
The most likely problem is that some firewall on the Windows machine is<br>
blocking port 4005.=C2=A0 You may need to configure that firewall to allow =
ssh to<br>
listen on localhost:4005 and/or to accept connections to it from Spacemacs.=
<br>
In theory you might have similar localhost firewall issues on hal9000, but<=
br>
that is less likely.<br>
<br>
<br>
&gt;=C2=A0 =C2=A0 2. Do I need bi-directional traffic on 22? (after recent =
changes I<br>
&gt;=C2=A0 =C2=A0 cannot ssh or scp into my Windows machine)<br>
<br>
I&#39;m assuming that you ran the ssh command on the Windows 10 machine and=
 it<br>
gave you a working login to hal9000.=C2=A0 If so, then it looks like you al=
ready<br>
have what you need for port 22.<br></blockquote><div><br></div><div>Yes, I =
can log in to hal9000 with the -L switch:</div><div><br></div><div><font fa=
ce=3D"monospace">&gt; ssh -L4005:localhost:4005 mirko@hal9000<br>Last login=
: Thu Mar 19 14:33:17 2020 from 172.27.236.189<br>[mirko@hal9000 ~]$</font>=
<br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">
<br>
Note that bi-directional traffic on a connected socket is different from<br=
>
whether you can make a connection in both directions.<br>
<br>
<br>
&gt;=C2=A0 =C2=A0 3. What tools can I use to try to narrow down the cause o=
f the problem?<br>
&gt;=C2=A0 =C2=A0 For instance, can I send a command to the lisp image, and=
 see its effects<br>
&gt;=C2=A0 =C2=A0 on the lisp side?<br>
<br>
Firstly, run &quot;netstat -antp&quot; on hal9000 to see if Lisp is listeni=
ng on port<br>
4005.<br></blockquote><div><br></div><div>It looks that ccl-bin is listenin=
g:</div><font face=3D"monospace">$ sudo netstat -antp | grep :4005<br>tcp =
=C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 <a href=3D"http://127.0.=
0.1:4005">127.0.0.1:4005</a> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00.0.0.0:* =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LISTEN =C2=A0 =C2=A0 =C2=
=A0104461/lx86cl64</font><br><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">
<br>
Secondly, run &quot;netstat -anop tcp&quot; on the Windows 10 machine to se=
e if ssh is<br>
listening on port 4005.<br>
<br></blockquote><div><br></div><div>I have Msys2&#39;s netstat. On the lap=
top:<br><font face=3D"monospace">&gt; which netstat<br>/c/WINDOWS/system32/=
netstat<br>/c/Users/mirko/Downloads<br>&gt; netstat -anop tcp | grep :4005<=
br>=C2=A0 TCP =C2=A0 =C2=A0<a href=3D"http://127.0.0.1:4005">127.0.0.1:4005=
</a> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://0.0.0.0:0">0.0.0.0:0</a>=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0LISTENING =C2=A0 =C2=A0 =
=C2=A0 12052</font><br></div><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">
Thirdly, run &quot;ssh -p 4005 localhost&quot; on the Windows 10 machine.=
=C2=A0 This use a<br>
ssh is very bogus, but it should at least give an error message with some<b=
r>
diagnostics.=C2=A0 (Normally I would use telnet for this, but it is not ins=
talled<br>
on Windows 10 by default.)<br></blockquote><div><br></div><div>Outputs of b=
oth ssh and telnet on the laptop:</div><div><font face=3D"monospace">&gt; w=
hich telnet<br>/usr/bin/telnet<br>/c/Users/mirko/Downloads<br>&gt; telnet l=
ocalhost 4005<br>Trying ::1...<br>Connected to localhost.<br>Escape charact=
er is &#39;^]&#39;.<br>Connection closed by foreign host.<br>/c/Users/mirko=
/Downloads<br>&gt; ssh -p 4005 localhost<br>kex_exchange_identification: re=
ad: Connection reset by peer</font><br></div><div>=C2=A0</div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">
<br>
__Martin<br></blockquote><div><br></div><div>Summarizing: of the tests you =
suggested, all pass but the last one (to ssh or telnet into port 4005).</di=
v><div><br></div><div>Thank you for your assistance so far,</div><div><br><=
/div><div>Mirko=C2=A0</div></div></div>

--00000000000073474f05a23a4347--