Skip to content

Commit

Permalink
Automatically install SSH host keys for public regions
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcdawkins committed Dec 15, 2023
1 parent 47cade7 commit 102c985
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 15 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
}
},
"scripts": {
"update-countries": "php scripts/update-countries.php"
"update-countries": "php scripts/update-countries.php",
"update-known-hosts": "php scripts/update-known-hosts.php"
}
}
5 changes: 5 additions & 0 deletions config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ api:
# The timeout in seconds for a "git push" command. Set to null for no timeout.
git_push_timeout: 3600

# A file containing SSH host keys to install for the user.
# If a relative path is given, it is considered relative to the CLI source
# code root. Note this will need to be built into the Phar.
ssh_host_keys_file: resources/ssh/host-keys

# How the CLI detects and configures Git repositories as projects.
detection:
## Required keys that must be defined elsewhere:
Expand Down
30 changes: 30 additions & 0 deletions resources/ssh/host-keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
git.au-2.platform.sh ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3GhkAUQ/+wx9oBekSKqCIQZqKBh4MaqrdguK0poqwEBMzbKGo5WtQSwN2nx0RWDNTJFJ0ipaC9XszJBc53O+cNncvj9OyFNh9zBclxRFt1bgAs+upORs5GXAaA2Xzfx6VCfBLG/uN65etZLV+klP9yAqgyRjOQqJG8IUejeuGb+TA+aXBupm1SHIffqQm/TMLqdfKn5Uz9MkVXYfkVMM2oQyVRvAKsqS9DiZs/kkubBhetaAt03lpjXm69jm9rCusw/GTODwd3LESzPe9fl38wkVbTJ9M9ia+5bxZMbF0oScNeV0CpQ0VU34dv9prGSlekVM7i6Ww06Cn9QEtTIhX
git.au.platform.sh ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNswNEfbW/j3/mIuMVU10lWFSxYDcoqUPaAWqsr76oMsHkRR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enLV5SLsD98Y1a7ARm1fqM1LuiMMExneD5TuRU+5J33kkCMlf/6JvYm52ppacM0+f1QDAbuKjqAM68ntRHAeQuL42Y9LWDbdYl9Slq3Z7tqzmy23n
ssh.us.platform.sh ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTrolLNSsqP9rtd7NDiH0D7mwIuSJYBx3HxLv/84PFrEPJE0nXlbYpa0dMdo38ZFUaJw05nXfh7y1OSuKHw1ohfsmUT6cA+F13fbMyXBRKG69TNuHBt3cvSQ3HngSyZ3P9TXj7UyuCK2eDYiiUrsrBmZM7WQD/lsE63/PufOCQk3BwIS/xT+ZNiaXHRZBHR70cQcn8Nn3FfDrtf/WRtcytgm/8A8rd4YWyJsmhDUlS7j/8oP7DcB0yPNq1QGuEJPF0zQGiXd/ySbaaZPvEyMbW+mvox7rxgUViIqGw3s5ys1nFCmd/SYCJrfC1i+q4z13n7RkfMBaNBc0eufT2WHeJ
84 changes: 84 additions & 0 deletions scripts/update-known-hosts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env php
<?php
/**
* @file
* Fetches SSH host keys for Platform.sh public regions.
*/

use Platformsh\Cli\Service\Api;
use Platformsh\Cli\Service\Config;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\Process;

require dirname(__DIR__) . '/vendor/autoload.php';

$config = new Config();
$output = new ConsoleOutput();
$stdErr = $output->getErrorOutput();

if ($config->has('api.ssh_host_keys')) {
$stdErr->writeln('Skipping updating host keys (they are already defined in config)');
exit(0);
}

$api = new Api($config, null, $output);

if (!$api->isLoggedIn()) {
$stdErr->writeln('Skipping updating the list of regions from the API (not logged in)');
exit(0);
}

$stdErr->writeln('Fetching the list of regions from the API...');
$regions = $api->getClient()->getRegions();

$regionDomains = [];
foreach ($regions as $region) {
if ($region->private) {
continue;
}
$domain = \parse_url($region->endpoint, PHP_URL_HOST);
if (!$domain) {
$stdErr->writeln("Failed to parse hostname for region: " . $region['id']);
continue;
}
$regionDomains[] = $domain;
}

$stdErr->writeln(\count($regionDomains) . ' region domain(s) found');

$scanners = [];
foreach ($regionDomains as $regionDomain) {
foreach (['git.', 'ssh.'] as $prefix) {
$proc = new Process(['ssh-keyscan', $prefix . $regionDomain]);
$proc->start();
$scanners[$prefix . $regionDomain] = $proc;
}
}

$stdErr->writeln(\count($scanners) . ' ssh-keyscan processes started');

$scannedHosts = [];
while (count($scanners)) {
foreach ($scanners as $host => $scanner) {
if (!$scanner->isRunning()) {
if ($scanner->isSuccessful()) {
$stdErr->writeln('Scanned host ' . $host);
$scannedHosts[$host] = trim($scanner->getOutput());
} else {
$stdErr->writeln(sprintf('Failed to scan host %s: %s', $host, $scanner->getErrorOutput()));
exit(1);
}
unset($scanners[$host]);
}
}
usleep(300000);
}

ksort($scannedHosts);

$fs = new Filesystem();

$keys_filename = dirname(__DIR__) . '/resources/ssh/host-keys';
$fs->dumpFile($keys_filename, implode("\n", array_values($scannedHosts)) . "\n");
$stdErr->writeln(sprintf('Written to file: <info>%s</info>', $keys_filename));
12 changes: 8 additions & 4 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2132,9 +2132,13 @@ protected function finalizeLogin()
$client = $this->api()->getClient(false, true);
$this->stdErr->writeln('You are logged in.');

// Generate a new certificate from the certifier API.
/** @var \Platformsh\Cli\Service\SshConfig $sshConfig */
$sshConfig = $this->getService('ssh_config');

// Configure SSH host keys.
$sshConfig->configureHostKeys();

// Generate a new certificate from the certifier API.
/** @var \Platformsh\Cli\SshCert\Certifier $certifier */
$certifier = $this->getService('certifier');
if ($certifier->isAutoLoadEnabled() && $sshConfig->checkRequiredVersion()) {
Expand All @@ -2149,10 +2153,10 @@ protected function finalizeLogin()
}
}

// Write SSH configuration.
/** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
$questionHelper = $this->getService('question_helper');
// Write session-based SSH configuration.
if ($sshConfig->configureSessionSsh()) {
/** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
$questionHelper = $this->getService('question_helper');
$sshConfig->addUserSshConfig($questionHelper);
}

Expand Down
1 change: 1 addition & 0 deletions src/Command/SshCert/SshCertLoadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->displayCertificate($sshCert);
}

$sshConfig->configureHostKeys();
$hasSessionConfig = $sshConfig->configureSessionSsh();

if ($input->getOption('refresh-only')) {
Expand Down
19 changes: 12 additions & 7 deletions src/Service/Ssh.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ protected function getSshOptions()

$options['SendEnv'] = 'TERM';

if ($this->output->isDebug()) {
$options['LogLevel'] = 'DEBUG';
} elseif ($this->output->isVeryVerbose()) {
$options['LogLevel'] = 'VERBOSE';
} elseif ($this->output->isQuiet()) {
$options['LogLevel'] = 'QUIET';
}

if ($this->input->hasOption('identity-file') && $this->input->getOption('identity-file')) {
$file = $this->input->getOption('identity-file');
if (!file_exists($file)) {
Expand Down Expand Up @@ -144,15 +152,12 @@ protected function getSshOptions()
$options['IdentityFile'] = \array_unique($options['IdentityFile']);
}

if ($this->output->isDebug()) {
$options['LogLevel'] = 'DEBUG';
} elseif ($this->output->isVeryVerbose()) {
$options['LogLevel'] = 'VERBOSE';
} elseif ($this->output->isQuiet()) {
$options['LogLevel'] = 'QUIET';
// Configure host keys and link them.
if (($keysFile = $this->sshConfig->configureHostKeys()) !== null) {
$options['UserKnownHostsFile'] = '~/.ssh/known_hosts ~/.ssh/known_hosts2 ' . $this->sshConfig->formatFilePath($keysFile);
}

// Ensure the session SSH config is up to date.
// Configure or validate the session SSH config.
$this->sshConfig->configureSessionSsh();

return $options;
Expand Down
Loading

0 comments on commit 102c985

Please sign in to comment.