[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 #!/usr/bin/env php 2 <?php 3 4 $root = dirname(dirname(dirname(__FILE__))); 5 require_once $root.'/scripts/__init_script__.php'; 6 7 try { 8 $cert = file_get_contents('php://stdin'); 9 $public_key = PhabricatorAuthSSHPublicKey::newFromRawKey($cert); 10 } catch (Exception $ex) { 11 exit(1); 12 } 13 14 $key = id(new PhabricatorAuthSSHKeyQuery()) 15 ->setViewer(PhabricatorUser::getOmnipotentUser()) 16 ->withKeys(array($public_key)) 17 ->executeOne(); 18 if (!$key) { 19 exit(1); 20 } 21 22 $object = $key->getObject(); 23 if (!($object instanceof PhabricatorUser)) { 24 exit(1); 25 } 26 27 $bin = $root.'/bin/ssh-exec'; 28 $cmd = csprintf('%s --phabricator-ssh-user %s', $bin, $object->getUsername()); 29 // This is additional escaping for the SSH 'command="..."' string. 30 $cmd = addcslashes($cmd, '"\\'); 31 32 $options = array( 33 'command="'.$cmd.'"', 34 'no-port-forwarding', 35 'no-X11-forwarding', 36 'no-agent-forwarding', 37 'no-pty', 38 ); 39 40 echo implode(',', $options); 41 exit(0);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |