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
Very cool: $ ssh mark@10.10.41.217 'module tasks' Number of Tasks = 15 Stack: Now Max Total Heap Task 3FFB4FA4 1 eventTask 448 2560 4096 54100 Task 3FFCC87C 2 CanRxTask 424 424 2048 0 Task 3FFD06B8 3 ipc0 388 436 1024 9240 Task 3FFD0CB0 4 ipc1 396 444 1024 32 Task 3FFD28C8 7 IDLE 356 468 1024 32 Task 3FFD2E58 8 IDLE 356 468 1024 32 Task 3FFD40F0 9 Tmr Svc 348 2220 4096 0 Task 3FFDC0FC 13 Housekeeping 328 1960 4096 46944 Task 3FFDF3D4 15 tiT 496 1232 2560 5576 Task 3FFE3B9C 16 SIMCOMTask 464 464 4096 0 Task 3FFE8B38 17 AsyncConsole 548 2468 5120 18708 Task 3FFEAA04 18 wifi 432 2048 4096 6000 Task 3FFEDB44 19 pmT 416 1408 2560 0 Task 3FFEEC68 20 rtT 404 596 3584 0 Task 3FFF1258 21 NetManTask 2644 5540 7168 12760 $ scp -q mark@10.10.41.217:/store/obd2ecu/4 /dev/tty 20; But no candy: $ sshfs -d mark@10.10.41.217:/store ~/Volumes/OVMS FUSE library version: 2.9.7 nullpath_ok: 0 nopath: 0 utime_omit_ok: 0 Connection to 10.10.41.217 closed by remote host. remote host has disconnected OVMS > E (1655031) ssh: Error in reception: -17 Regards, Mark.
On 10 Dec 2017, at 10:27 AM, Stephen Casner <casner@acm.org> wrote:
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 _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
On Sun, 10 Dec 2017, Mark Webb-Johnson wrote:
But no candy:
$ sshfs -d mark@10.10.41.217:/store ~/Volumes/OVMS FUSE library version: 2.9.7 nullpath_ok: 0 nopath: 0 utime_omit_ok: 0 Connection to 10.10.41.217 closed by remote host. remote host has disconnected
OVMS > E (1655031) ssh: Error in reception: -17
Error -17 is WS_UNIMPLEMENTED_E. I suspect that sshfs is using sftp protocol, not scp protocol. I have not implememted sftp. Hmmm, yes the first sentence of the README says as much Perhaps sshfs can be configured to use scp protocol instead? -- Steve
Urgh. OK, don’t worry about it. I don’t think sshfs can use scp mode, but it is not all that important. Raw scp is workable. Regards, Mark
On 10 Dec 2017, at 1:49 PM, Stephen Casner <casner@acm.org> wrote:
On Sun, 10 Dec 2017, Mark Webb-Johnson wrote:
But no candy:
$ sshfs -d mark@10.10.41.217:/store ~/Volumes/OVMS FUSE library version: 2.9.7 nullpath_ok: 0 nopath: 0 utime_omit_ok: 0 Connection to 10.10.41.217 closed by remote host. remote host has disconnected
OVMS > E (1655031) ssh: Error in reception: -17
Error -17 is WS_UNIMPLEMENTED_E. I suspect that sshfs is using sftp protocol, not scp protocol. I have not implememted sftp. Hmmm, yes the first sentence of the README says as much
Perhaps sshfs can be configured to use scp protocol instead?
-- Steve _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
participants (2)
-
Mark Webb-Johnson -
Stephen Casner