Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
658b0ccb
Commit
658b0ccb
authored
Jan 27, 2010
by
Srikanth Chikkulapelly
Browse files
Script to generate admin credentials. It needs admin user urn and CM urn as command line arguments.
parent
e2f5f9dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/scripts/genadmincredential.in
0 → 100644
View file @
658b0ccb
#!/usr/bin/perl -wT
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use
strict
;
use
Exporter
;
use
vars
qw(@ISA @EXPORT)
;
@ISA
=
"
Exporter
";
@EXPORT
=
qw (
);
use
GeniCredential
;
use
GeniCertificate
;
use
GeniAuthority
;
use
GeniHRN
;
use
GeniResponse
;
use
GeniUser
;
sub
CreateAdminCredential
()
{
my
$owner_urn
=
shift
;
my
$target_cm_urn
=
shift
;
#
# Must be an emulab user who is talking to us.
# If any of the URN specofoed is invalid do no accept.
if
(
!
(
GeniHRN::
IsValid
(
$owner_urn
)
&&
GeniHRN::
IsValid
(
$target_cm_urn
)))
{
return
GeniResponse
->
MalformedArgsResponse
();
}
my
$geniuser
=
GeniUser
->
Lookup
(
$owner_urn
);
if
(
!
defined
(
$geniuser
))
{
return
GeniResponse
->
Create
(
GENIRESPONSE_FORBIDDEN
,
undef
,
"
Who are you?
");
}
my
$authority
=
GeniAuthority
->
Lookup
(
$target_cm_urn
);
if
(
!
defined
(
$authority
))
{
print
STDERR
"
Could not find local authority object for
$target_cm_urn
\n
";
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
);
}
my
$credential
=
GeniCredential
->
CreateSigned
(
$authority
,
$geniuser
,
$
GeniCredential::
LOCALSA_FLAG
);
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
)
if
(
!
defined
(
$credential
));
return
GeniResponse
->
Create
(
GENIRESPONSE_SUCCESS
,
$credential
->
asString
());
}
print
CreateAdminCredential
@ARGV
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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