Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xCAT-server]Change DNS/DHCP control key algorithm MD5 -> SHA512 #6797

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xCAT-server/lib/xcat/plugins/ddns.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ sub update_namedconf {
if ($ctx->{privkey}) {

#for now, assume the field is correct
#push @newnamed,"key xcat_key {\n","\talgorithm hmac-md5;\n","\tsecret \"".$ctx->{privkey}."\";\n","};\n\n";
#push @newnamed,"key xcat_key {\n","\talgorithm hmac-sha512;\n","\tsecret \"".$ctx->{privkey}."\";\n","};\n\n";
push @newnamed, $line;
do {
$i++;
Expand Down Expand Up @@ -1351,7 +1351,7 @@ sub update_namedconf {
$ctx->{privkey} = encode_base64(genpassword(32));
chomp($ctx->{privkey});
}
push @newnamed, "key xcat_key {\n", "\talgorithm hmac-md5;\n", "\tsecret \"" . $ctx->{privkey} . "\";\n", "};\n\n";
push @newnamed, "key xcat_key {\n", "\talgorithm hmac-sha512;\n", "\tsecret \"" . $ctx->{privkey} . "\";\n", "};\n\n";
$ctx->{restartneeded} = 1;
}
}
Expand Down
16 changes: 8 additions & 8 deletions xCAT-server/lib/xcat/plugins/dhcp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ sub listnode
print $OMIN "key "
. $omapiuser . " \""
. $omapikey . "\"\n";
print $OMIN "key-algorithm HMAC-SHA512\n";
print $OMIN "connect\n";
print $OMIN "new host\n";

Expand Down Expand Up @@ -258,6 +259,7 @@ sub listnode
print $OMIN6 "key "
. $omapiuser . " \""
. $omapikey . "\"\n";
print $OMIN6 "key-algorithm HMAC-SHA512\n";
print $OMIN6 "connect\n";
print $OMIN6 "new host\n";

Expand Down Expand Up @@ -2035,19 +2037,17 @@ sub process_request
print $omshell "key "
. $ent->{username} . " \""
. $ent->{password} . "\"\n";
if ($::XCATSITEVALS{externaldhcpservers}) {
print $omshell "server $::XCATSITEVALS{externaldhcpservers}\n";
}
print $omshell "key-algorithm HMAC-SHA512\n";
print $omshell "server $::XCATSITEVALS{externaldhcpservers}\n" if($::XCATSITEVALS{externaldhcpservers});
print $omshell "connect\n";
if ($usingipv6) {
open($omshell6, "|/usr/bin/omshell > /dev/null");
if ($::XCATSITEVALS{externaldhcpservers}) {
print $omshell "server $::XCATSITEVALS{externaldhcpservers}\n";
}
print $omshell "server $::XCATSITEVALS{externaldhcpservers}\n" if($::XCATSITEVALS{externaldhcpservers});
print $omshell6 "port 7912\n";
print $omshell6 "key "
. $ent->{username} . " \""
. $ent->{password} . "\"\n";
print $omshell6 "key-algorithm HMAC-SHA512\n";
print $omshell6 "connect\n";
}
}
Expand Down Expand Up @@ -2963,7 +2963,7 @@ sub newconfig6 {
# push @dhcp6conf, "update-static-leases on;\n";
push @dhcp6conf, "omapi-port 7912;\n"; #Enable omapi...
push @dhcp6conf, "key xcat_key {\n";
push @dhcp6conf, " algorithm hmac-md5;\n";
push @dhcp6conf, " algorithm hmac-sha512;\n";
my $passtab = xCAT::Table->new('passwd', -create => 1);
(my $passent) =
$passtab->getAttribs({ key => 'omapi', username => 'xcat_key' }, 'password');
Expand Down Expand Up @@ -3026,7 +3026,7 @@ sub newconfig
push @dhcpconf, "\n";
push @dhcpconf, "omapi-port 7911;\n"; #Enable omapi...
push @dhcpconf, "key xcat_key {\n";
push @dhcpconf, " algorithm hmac-md5;\n";
push @dhcpconf, " algorithm hmac-sha512;\n";
(my $passent) =
$passtab->getAttribs({ key => 'omapi', username => 'xcat_key' }, 'password');
my $secret = encode_base64(genpassword(32)); #Random from set of 62^32
Expand Down
1 change: 1 addition & 0 deletions xCAT-server/share/xcat/tools/dhcpop
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ if($help){
print $omshell "key "
. $id . " \""
. $passwd . "\"\n";
print $omshell "key-algorithm HMAC-SHA512\n";
print $omshell "connect\n";

if($hostname){
Expand Down