Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893461
ssh-auth-key.php
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
920 B
Referenced Files
None
Subscribers
None
ssh-auth-key.php
View Options
#!/usr/bin/env php
<?php
$root
=
dirname
(
dirname
(
dirname
(
__FILE__
)
)
)
;
require_once
$root
.
'/scripts/__init_script__.php'
;
try
{
$cert
=
file_get_contents
(
'php://stdin'
)
;
$public_key
=
PhabricatorAuthSSHPublicKey
::
newFromRawKey
(
$cert
)
;
}
catch
(
Exception
$ex
)
{
exit
(
1
)
;
}
$key
=
id
(
new
PhabricatorAuthSSHKeyQuery
(
)
)
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
(
)
)
->
withKeys
(
array
(
$public_key
)
)
->
executeOne
(
)
;
if
(
!
$key
)
{
exit
(
1
)
;
}
$object
=
$key
->
getObject
(
)
;
if
(
!
(
$object
instanceof
PhabricatorUser
)
)
{
exit
(
1
)
;
}
$bin
=
$root
.
'/bin/ssh-exec'
;
$cmd
=
csprintf
(
'%s --phabricator-ssh-user %s'
,
$bin
,
$object
->
getUsername
(
)
)
;
// This is additional escaping for the SSH 'command="..."' string.
$cmd
=
addcslashes
(
$cmd
,
'"\\'
)
;
$options
=
array
(
'command="'
.
$cmd
.
'"'
,
'no-port-forwarding'
,
'no-X11-forwarding'
,
'no-agent-forwarding'
,
'no-pty'
,
)
;
echo
implode
(
','
,
$options
)
;
exit
(
0
)
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 18:28 (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1109871
Default Alt Text
ssh-auth-key.php (920 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment