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
440f399a
Commit
440f399a
authored
Jul 27, 2017
by
Mike Hibler
Browse files
Add hack -G option to generate root keypair for an existing experiment.
parent
ce2c4542
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/pushrootkey.in
View file @
440f399a
...
...
@@ -38,12 +38,14 @@ sub usage()
"
-d Turn on debugging
\n
"
.
"
-n Impotent mode
\n
"
.
"
-e Push key to all nodes in given experiment
\n
"
.
"
-G Generate keypair in DB if it doesn't already exist
\n
"
.
"
node ... Nodes push key to (must all be in same experiment)
\n
");
exit
(
-
1
);
}
my
$optlist
=
"
dne:
";
my
$optlist
=
"
dne:
G
";
my
$debug
=
0
;
my
$impotent
=
0
;
my
$genkeys
=
0
;
my
$exptstr
;
#
...
...
@@ -92,6 +94,9 @@ if (defined($options{"n"})) {
if
(
defined
(
$options
{"
e
"}))
{
$exptstr
=
$options
{"
e
"};
}
if
(
defined
(
$options
{"
G
"}))
{
$genkeys
=
1
;
}
if
(
@ARGV
==
0
&&
!
$exptstr
)
{
print
STDERR
"
Must specify either an experiment or a list of nodes
\n
";
usage
();
...
...
@@ -100,6 +105,10 @@ if (@ARGV > 0 && $exptstr) {
print
STDERR
"
Cannot specify both an experiment and nodes
\n
";
usage
();
}
if
(
$genkeys
&&
!
$exptstr
)
{
print
STDERR
"
Can only use -G with -e
\n
";
usage
();
}
# Load the Testbed support stuff.
use
lib
"
@prefix
@/lib
";
...
...
@@ -130,6 +139,17 @@ if ($exptstr) {
}
}
#
# Generate the keys if needed
#
if
(
$genkeys
)
{
my
$key
=
$expt
->
GetPrivkey
();
if
(
!
$key
)
{
print
STDERR
"
Generating root keypair for
$exptstr
...
\n
";
$expt
->
GenerateKeys
();
}
}
my
@nodeids
=
();
foreach
my
$node
(
@nodes
)
{
my
$nodeid
=
$node
->
node_id
();
...
...
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