Added call and passwd configuration

This commit is contained in:
praetor 2019-03-19 13:27:58 +00:00
parent 3ea474521d
commit 63bf67a6fd
1 changed files with 31 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#
use warnings;
use strict;
use Digest::MD5 qw(md5_hex);
my $myNode = $ARGV[0];
@ -19,8 +20,10 @@ sub getNodes {
my $nodeAddress = $fields[1];
generatePort($nodeName,$nodeAddress);
generateSys($nodeName);
generateCall($nodeName);
generatePasswd($nodeName);
getKeys($nodeAddress);
generateConfig();
generateConfig($myNode);
print("System ".$nodeName." added successfully\n");
}
@ -93,6 +96,33 @@ sub getKeys {
system($cmd);
}
sub generateCall{
my $nodeName = shift;
my $callFile = "call";
my $password = $nodeName.$myNode;
my $callHash = md5_hex($password);
my $callPasswd = $nodeName."\t"."U".$myNode."\t".$callHash."\n";
open(FH, '>>', $callFile);
print FH $callPasswd;
}
sub generatePasswd {
my $nodeName = shift;
my $passwdFile = "passwd";
my $password = $myNode.$nodeName;
my $passwdHash = md5_hex($password);
my $authPasswd = "U".$nodeName."\t".$passwdHash."\n";
open(FH, '>>', $passwdFile);
print FH $authPasswd;
}
sub preCheck()
{
print("Updating git repo\n");