Commit 5745ab4c authored by Jürgen Haas's avatar Jürgen Haas

#15 Make SSH auth socket optional

parent dbad82b5
Pipeline #3111 passed with stage
in 3 seconds
......@@ -143,6 +143,8 @@ There are potentially more options possible, for details please refer to the Dru
#### Configure SSH access from the PHP container
This feature is only available if SSH agent forwarding is enabled on your host. There is a [good tutorial](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/#your-local-ssh-agent-must-be-running) available if you need any help.
Your host SSH configuration is automatically forwarded to the PHP docker container using sockets and you don't have to do anything to make it work, as long as your host is configured correctly to access your live site via SSH - in this case the PHP container can too. This works by mounting and forwarding your `SSH_AUTH_SOCK` environment variable to `/ssh-agent` inside the PHP container, so that the user inside that container can utilize your SSH settings like your user outside the contain who built them.
Typical issues that may cause trouble in this context are:
......
......@@ -129,6 +129,10 @@ class Handler {
$settingsPath = 'settings/default';
}
// Check if SSH auth sockets are supported.
$ssh_auth_sock = getenv('SSH_AUTH_SOCK');
$options['php']['ssh'] = !empty($ssh_auth_sock);
// Provide all the required files.
$twig_loader = new \Twig_Loader_Array([]);
$twig = new \Twig_Environment($twig_loader);
......
......@@ -36,11 +36,15 @@ services:
{% if blackfire.enable %}
PHP_BLACKFIRE: 1
{% endif %}
{% if php.ssh %}
SSH_AUTH_SOCK: /ssh-agent
{% endif %}
volumes:
- ./:/var/www/html
- ./drush:/etc/drush
{% if php.ssh %}
- $SSH_AUTH_SOCK:/ssh-agent
{% endif %}
{% if webgrind.enable %}
- files:/mnt/files
{% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment