-
Install
socatanddtachon all hosts, andopensslon at least one host. Andvimon the server! -
Generate two self-signed keypairs. You can accept all default values.
for h in server client; do openssl req -newkey rsa:2048 -nodes -keyout $h-key.pem -x509 -days 365 -out $h-cert.pem done
-
Place
server-cert.pem,server-key.pem, andclient-cert.pemon one host. Placeclient-cert.pem,client-key.pem, andserver-cert.pemon the other host. Repeat as many times as desired, reusing theserver-*files and generating a new set ofclient-*files for each client. -
On the server, run
socat OPENSSL-LISTEN:12346,method=TLS1.2,cert=server-certificate.pem,key=server-key.pem,cafile=client-certificate.pem,verify=1,cipher=HIGH,commonname='' UNIX-CONNECT:dtach-vim dtach -c dtach-vim vimNote the use of
commonname=''; in socat >= 1.7.3.0, this must match the certificate. -
On the client(s), run
socat UNIX-LISTEN:dtach-vim OPENSSL:server-hostname:12346,method=TLS1.2,cert=client-certificate.pem,key=client-key.pem,cafile=server-certificate.pem,commonname='' dtach -a dtach-vim -
The server and client(s) now all have simultaneous full access to the server's dtach session. vim is only running on the server. If you're pair programming, remember that there is only one cursor!
-
Consider running vim in restricted mode (
-Z, http://vimdoc.sourceforge.net/htmldoc/starting.html#-Z) if you don't trust the other participants. If you do trust them, then you can just give them ssh access and skip most of the trouble.
Last active
March 13, 2020 00:29
-
-
Save elebow/c3fbdb0668aac22ba68283c88c5802b5 to your computer and use it in GitHub Desktop.
Use socat(1) and dtach(1) to share a single vim session among multiple remote hosts. Great for pair programming.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment