[pve-devel] [PATCH] assemble_spice_ticket
Alexandre Derumier
aderumier at odiso.com
Tue Jun 25 09:12:52 CEST 2013
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/AccessControl.pm | 18 ++++++++++++++++++
control.in | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/PVE/AccessControl.pm b/PVE/AccessControl.pm
index a9bf2dd..44299ce 100644
--- a/PVE/AccessControl.pm
+++ b/PVE/AccessControl.pm
@@ -5,6 +5,7 @@ use Encode;
use Crypt::OpenSSL::Random;
use Crypt::OpenSSL::RSA;
use MIME::Base64;
+use MIME::Base32 qw( RFC );
use Digest::SHA;
use PVE::Tools qw(run_command lock_file file_get_contents split_list safe_print);
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file);
@@ -213,6 +214,23 @@ sub verify_vnc_ticket {
return undef;
}
+sub assemble_spice_ticket {
+ my ($username, $path) = @_;
+
+ my $rsa_priv = get_privkey();
+
+ my $timestamp = sprintf("%08X", time());
+
+ my $plain = "PVESPICE:$timestamp";
+
+ $path = normalize_path($path);
+
+ my $full = "$plain:$path";
+
+ my $ticket = $plain . "::" . encode_base64($rsa_priv->sign($full), '');
+ return MIME::Base32::encode($ticket."::".$full);
+}
+
sub check_user_exist {
my ($usercfg, $username, $noerr) = @_;
diff --git a/control.in b/control.in
index 8458336..1062ffa 100644
--- a/control.in
+++ b/control.in
@@ -3,7 +3,7 @@ Version: @@VERSION@@-@@PKGRELEASE@@
Section: perl
Priority: optional
Architecture: @@ARCH@@
-Depends: libc6 (>= 2.3), perl (>= 5.6.0-16), libcrypt-openssl-rsa-perl, libcrypt-openssl-random-perl, libjson-xs-perl, libjson-perl, libterm-readline-gnu-perl,libnet-ldap-perl, libpve-common-perl, pve-cluster, libauthen-pam-perl
+Depends: libc6 (>= 2.3), perl (>= 5.6.0-16), libcrypt-openssl-rsa-perl, libcrypt-openssl-random-perl, libjson-xs-perl, libjson-perl, libterm-readline-gnu-perl,libnet-ldap-perl, libpve-common-perl, pve-cluster, libauthen-pam-perl , libmime-base32-perl
Maintainer: Proxmox Support Team <support at proxmox.com>
Description: Proxmox VE access control library
This package contains the role based user management and access
--
1.7.10.4
More information about the pve-devel
mailing list