To run Ubuntu Virtual Machine in DockerHub. Login via ssh, Getting IP & Port via write.as, Reverse Tunneling through serveo.net.
Don't think it runs forever 😄 see this
- Set IP and Port (like IP:Port or IP|22:Port) to which the machine request for Reverse Tunneling in write.as and change the url in L4ssh.sh with your write.as url.
Q) why not raw-gist?
Although raw-git is a little bit easier than write.as it has some delay to host the updated changes.
Then among others it is easy to parse value from source code in write.as .
If you want to use raw-gist replace line no. 11 and 36 as ip="$(curl ${url}|sed -r "s/:/ -R /g;s/\|/ -p /g")"
Don't forgot to make raw-gist link in 'https://gist.githubusercontent.com/<username>/<hash>/raw/<filename>' format.
Alternative to Serveo you can use your local machine as Tunneling service (if your IP is static). For this you can specify IP, Port (in which ssh-server is running) and RPort (in which you can connect for ssh-session) in your write.as page (like IP|Port:RPort).
You can also run Serveo Server in your local machine (see this).
-
Goto DockerHub, create a repository. While creating repo choose github in Build Settings and select username and github-repo. Then create a Build Rule. Finally click 'Create' button.
-
Now goto builds tab in docker repo and press 'Trigger' button in Automated Builds section.
-
Build will be started after sometime. Now, 'L4ssh.sh' script is running and listening for ssh logins.
-
Now,
ssh user@IP -p Port -o "ServerAliveInterval 10"
will login into VM running in DockerHub and password is 'passwd'.
user is username according to this Dockerfile. It can be changed by replacing 'user:passwd' by 'username:password' in Dockerfile. Root password for this VM is 'toor' again it can also be changed in the Dockerfile.
To make L4ssh not to start Reverse Tunneling. If Reverse Tunneling already started it will close if no ssh session running otherwise it waits. Also if Reverse Tunneling started within 5Mins ago it will wait (untill this 5Mins ends).
Same as <close> but it waits for nothing.
To exit L4ssh. It also wait for nothing.
To command L4ssh to exit from ssh session. Just creating '/Exit' file touch /Exit
will make L4ssh exit immediately.
Every time L4ssh exiting it exits with value in '/Ecode' as return code exit $(cat /Ecode)
.
And it can be modified within ssh session.