<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lipido&#039;s Lab &#187; ssh</title>
	<atom:link href="https://www.sing-group.org/~lipido/blog/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sing-group.org/~lipido/blog</link>
	<description>Web 2.0: &#34;nobody even knows what it means&#34;, Tim Berners</description>
	<lastBuildDate>Wed, 01 Apr 2020 07:57:31 +0000</lastBuildDate>
	<language>es-ES</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>Create a SSH gateway for Git SSH backends</title>
		<link>https://www.sing-group.org/~lipido/blog/2016/12/03/create-a-ssh-gateway-for-git-ssh-backends/</link>
		<comments>https://www.sing-group.org/~lipido/blog/2016/12/03/create-a-ssh-gateway-for-git-ssh-backends/#comments</comments>
		<pubDate>Sat, 03 Dec 2016 11:58:03 +0000</pubDate>
		<dc:creator><![CDATA[lipido]]></dc:creator>
				<category><![CDATA[Informática]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitlab]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://sing.ei.uvigo.es/~lipido/blog/?p=279</guid>
		<description><![CDATA[This post shows how to connect to a Gitlab (or any Git SSH server) private server via SSH through a front-end public server you own. [CLIENT] --&#62; [FRONT-END SSH-SERVER] --&#62; [BACK-END GIT SSH-SERVER] On Git back-end server Create the keys for your users as usual (in this example, we assume Gitlab, so the web interface [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>This post shows how to connect to a Gitlab (or any Git SSH server) private server via SSH through a front-end public server you own.</p>
<p><code>[CLIENT] --&gt; [FRONT-END SSH-SERVER] --&gt; [BACK-END GIT SSH-SERVER]</code></p>
<h2>On Git back-end server</h2>
<p>Create the keys for your users as usual (in this example, we assume Gitlab, so the web interface is enough)</p>
<p>Go to the file /var/opt/gitlab/.ssh/authorized_keys and copy all entries. An example of the contents of this file with two users could be:<br />
<code><br />
command="/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3Nz...rbR6L75887 user1@gmail.com<br />
command="/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell key-2",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1...hVE/141 user2@hotmail.com<br />
</code></p>
<h2>On front-end (intermediate) server</h2>
<p>Create the user git, and create and edit the .ssh/authorized_keys file.<br />
<code>sudo adduser git<br />
su git<br />
mkdir .ssh<br />
touch ./ssh/authorized_keys &amp;&amp; chmod 700 .ssh/authorized_keys<br />
</code></p>
<p>Paste the contents of the file, but by replacing the &#8220;command&#8221; in each entry with this content:</p>
<p><code>command="ssh git@backend-server $SSH_ORIGINAL_COMMAND" ssh-rsa AAAAB3Nz...rbR6L75887 user1@gmail.com<br />
command="ssh git@backend-server $SSH_ORIGINAL_COMMAND" ssh-rsa AAAAB3NzaC1...hVE/141 user2@hotmail.com<br />
</code></p>
<h2>On client machine</h2>
<p>Create or edit your .ssh/config file by adding the following entry:<br />
<code>host frontend-server-name.com<br />
hostname frontend-server-name.com<br />
user git<br />
identityfile /home/user1/.ssh/id_rsa<br />
ForwardAgent yes<br />
</code><br />
The important element here is <b>ForwardAgent</b> which allows the intermediate server to use our key when login via ssh to the backend server. You may need to add the key explicity to the SSH agent via:</p>
<p><code>ssh-add <code>/home/user1/.ssh/id_rsa</code><br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>https://www.sing-group.org/~lipido/blog/2016/12/03/create-a-ssh-gateway-for-git-ssh-backends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
