Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
cfce32a1
Commit
cfce32a1
authored
Oct 05, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement vncproxy API for openvz
parent
1e3c9d91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
OpenVZ.pm
PVE/API2/OpenVZ.pm
+85
-0
No files found.
PVE/API2/OpenVZ.pm
View file @
cfce32a1
...
...
@@ -461,6 +461,91 @@ __PACKAGE__->register_method({
return
undef
;
}});
my
$sslcert
;
__PACKAGE__
->
register_method
({
name
=>
'
vncproxy
',
path
=>
'
{vmid}/vncproxy
',
method
=>
'
POST
',
protected
=>
1
,
permissions
=>
{
path
=>
'
/vms/{vmid}
',
privs
=>
[
'
VM.Console
'
],
},
description
=>
"
Creates a TCP VNC proxy connections.
",
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
vmid
=>
get_standard_option
('
pve-vmid
'),
},
},
returns
=>
{
additionalProperties
=>
0
,
properties
=>
{
user
=>
{
type
=>
'
string
'
},
ticket
=>
{
type
=>
'
string
'
},
cert
=>
{
type
=>
'
string
'
},
port
=>
{
type
=>
'
integer
'
},
upid
=>
{
type
=>
'
string
'
},
},
},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$ticket
=
PVE::AccessControl::
assemble_ticket
(
$user
);
my
$vmid
=
$param
->
{
vmid
};
my
$node
=
$param
->
{
node
};
$sslcert
=
PVE::Tools::
file_get_contents
("
/etc/pve/pve-root-ca.pem
",
8192
)
if
!
$sslcert
;
my
$port
=
PVE::Tools::
next_vnc_port
();
my
$remip
;
if
(
$node
ne
PVE::INotify::
nodename
())
{
$remip
=
PVE::Cluster::
remote_node_ip
(
$node
);
}
# NOTE: vncterm VNC traffic is already TLS encrypted,
# so we select the fastest chipher here (or 'none'?)
my
$remcmd
=
$remip
?
['
/usr/bin/ssh
',
'
-c
',
'
blowfish-cbc
',
'
-t
',
$remip
]
:
[]
;
my
$shcmd
=
[
'
/usr/sbin/vzctl
',
'
enter
',
$vmid
];
my
$realcmd
=
sub
{
my
$upid
=
shift
;
syslog
('
info
',
"
starting openvz vnc proxy
$upid
\n
");
my
$timeout
=
10
;
my
$cmd
=
['
/usr/bin/vncterm
',
'
-rfbport
',
$port
,
'
-timeout
',
$timeout
,
'
-authpath
',
"
/vms/
$vmid
",
'
-perm
',
'
VM.Console
',
'
-c
',
@$remcmd
,
@$shcmd
];
PVE::Tools::
run_command
(
$cmd
);
return
;
};
my
$upid
=
$rpcenv
->
fork_worker
('
vncproxy
',
$vmid
,
$user
,
$realcmd
);
return
{
user
=>
$user
,
ticket
=>
$ticket
,
port
=>
$port
,
upid
=>
$upid
,
cert
=>
$sslcert
,
};
}});
__PACKAGE__
->
register_method
({
name
=>
'
vmcmdidx
',
path
=>
'
{vmid}/status
',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment