Make things automatic
When I am at home, I usually need remote access to my servers at work, to check some documents or to fill some data on our CRM. We are using openssh access to do remote maintenance of our products so I decide to provide that for remote access from home.
The idea is to make most of the configuration automatic so I have wrote a configuration file for that (~/.ssh/config).
Host job Hostname job.jeanpul.com User jeanpul Port 999 LocalForward *:8080 192.168.0.20:80 ControlMaster yes
With this configuration file, using the following command
ssh job
open a SSH connection to job.jeanpul.com on port 999 and then gives access to the Web server of the distant machine 192.168.0.20 on the local port 8080.
Browse your Intranet without URL redirection problems
So, then I reach the office Intranet network using the http://localhost:8080/ but all the absolute URL cannot be reached. So URL's like :<a href="/PHPMyAdmin/index.html">PHPMyAdmin</a>
works because it's leads to http://localhost:8080/PHPMyAdmin/index.html but
<a href="http://server1.office.net/PHPMyAdmin/index.html">PHPMyAdmin</a>
failed because server1.office.net have no meaning locally.
The solution I used was to install and configure a Web proxy. I used privoxy with the following configuration part
forward job.jeanpul.com localhost:8080 forward server1.office.net localhost:8080
Then I configure my browsers to use this proxy and URLs such as
http://server1.office.net/PHPMyAdmin/index.html
are correctly managed.
Removing password input
I have configured my SSH server to support remote connexion using private/public key so I never enter the user password anymore.
To do so, I have generated a private/public key :
ssh-keygen -t rsa
Then, I have copied the public part to the SSH user on the remote access :
ssh-copy-id -i ~/.ssh/id_rsa.pub job.jeanpul.com
Aucun commentaire:
Enregistrer un commentaire