[Ovmsdev] scp is implemented

Stephen Casner casner at acm.org
Sun Dec 10 10:27:28 HKT 2017


I have extended the SSH server in console_ssh to support SSH session
type "exec" in addition to the original "shell" session type.  This
allows the client ssh command to be followed by a command to the
executed on OVMS:

auge1221> ssh ovms vfs ls /store
ovms_config
scripts
events
testdir
auge1222>

It also allows use of the client's scp command to transfer files to or
from OVMS.  The clients scp command starts an ssh session and passes
along an scp command to be executed on the server's end.  On a
Unix-like system the server would execute the scp command as a
separate process, but on OVMS I have implemented the scp protocol
within console_ssh.

So, for example, I can use scp to fetch my startup script so I can
edit it to remove the extra command I added to set the logging level
for ssh while I was debugging and then write back the updated script:

auge1224> scp -r ovms:/store/events .
startmeup                                100%   72     0.1KB/s   00:00
auge1225> scp events/system.start/startmeup ovms:/store/events/system.start/
startmeup                                100%   56     0.1KB/s   00:00
auge1226>

In these examples you see that I am using public key authentication so
I don't have to enter a password.  Secure and very convenient!

The SSH implementation is a bit slow doing the public key calculations
so there is a pause of a few seconds as each command begins, but then
the files are transmitted expediously.  I have not attempted yet to do
tuning of build options for wolfssh for speed and memory usage.  I
have also not figured out yet how to perform the rekeying procedure
with this wolfssh library.  Because the rekeying is not implemented
properly some data may be lost when it occurs.  However, rekeying will
be triggered after about 1GB of data transfer, so it seems unlikely
that we will hit that trigger right away.

For those who have been wondering when this would be completed, sorry
for the delay.  The scp protocol is somewhat crude and there is no
document to specify it which meant I had to do experiments to figure
out the right actions at each step.  Finally I found the OpenSSH
implementation on github so I could RTSL.  After that testing all the
corner cases took a while.  I'm sure you all will let me know if you
find problems!

                                                        -- Steve



More information about the OvmsDev mailing list