Allow device SSH keys to be trusted
Summary:
Ref T6240. Some discussion in that task. In instance/cluster environments, daemons need to make Conduit calls that bypass policy checks.
We can't just let anyone add SSH keys with this capability to the web directly, because then an adminstrator could just add a key they own and start signing requests with it, bypassing policy checks.
Add a `bin/almanac trust-key --id <x>` workflow for trusting keys. Only trusted keys can sign requests.
Test Plan:
  - Generated a user key.
  - Generated a device key.
  - Trusted a device key.
  - Untrusted a device key.
  - Hit the various errors on trust/untrust.
  - Tried to edit a trusted key.
{F236010}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T6240
Differential Revision: https://secure.phabricator.com/D10878
			
			
This commit is contained in:
		| @@ -19,13 +19,15 @@ final class PhabricatorAuthSSHKeyGenerateController | ||||
|       $cancel_uri); | ||||
|  | ||||
|     if ($request->isFormPost()) { | ||||
|       $default_name = $key->getObject()->getSSHKeyDefaultName(); | ||||
|  | ||||
|       $keys = PhabricatorSSHKeyGenerator::generateKeypair(); | ||||
|       list($public_key, $private_key) = $keys; | ||||
|  | ||||
|       $file = PhabricatorFile::buildFromFileDataOrHash( | ||||
|         $private_key, | ||||
|         array( | ||||
|           'name' => 'id_rsa_phabricator.key', | ||||
|           'name' => $default_name.'.key', | ||||
|           'ttl' => time() + (60 * 10), | ||||
|           'viewPolicy' => $viewer->getPHID(), | ||||
|         )); | ||||
| @@ -36,7 +38,7 @@ final class PhabricatorAuthSSHKeyGenerateController | ||||
|       $body = $public_key->getBody(); | ||||
|  | ||||
|       $key | ||||
|         ->setName('id_rsa_phabricator') | ||||
|         ->setName($default_name) | ||||
|         ->setKeyType($type) | ||||
|         ->setKeyBody($body) | ||||
|         ->setKeyComment(pht('Generated')) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley