Sanitation
Whitespace fixes etc
This commit is contained in:
parent
c927fe8f1f
commit
ba260576b5
@ -73,20 +73,20 @@ if ($options{'help'}) {
|
|||||||
# check file parameter
|
# check file parameter
|
||||||
if ($options{'file'}) {
|
if ($options{'file'}) {
|
||||||
$key_file = $options{'file'};
|
$key_file = $options{'file'};
|
||||||
unless (-f $key_file) {
|
unless (-f $key_file) {
|
||||||
die "ERROR: input file $key_file not found [$!]";
|
die "ERROR: input file $key_file not found [$!]";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
die "ERROR: missing value for --file parameter";
|
die "ERROR: missing value for --file parameter";
|
||||||
}
|
}
|
||||||
# check label parameter
|
# check label parameter
|
||||||
if ($options{'label'}) {
|
if ($options{'label'}) {
|
||||||
$key_label = $options{'label'};
|
$key_label = $options{'label'};
|
||||||
if (not (defined ($key_label) or $key_label eq "")) {
|
if (not (defined ($key_label) or $key_label eq "")) {
|
||||||
die "ERROR: key label not defined";
|
die "ERROR: key label not defined";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
die "ERROR: missing value for --label parameter";
|
die "ERROR: missing value for --label parameter";
|
||||||
}
|
}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -99,33 +99,33 @@ close (KEY_FILE);
|
|||||||
|
|
||||||
# determine type of key
|
# determine type of key
|
||||||
if (grep { /$key_algo/ } @key_file) {
|
if (grep { /$key_algo/ } @key_file) {
|
||||||
$key_type = 1;
|
$key_type = 1;
|
||||||
} else {
|
} else {
|
||||||
$key_type = 2;
|
$key_type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
# process key
|
# process key
|
||||||
SWITCH: {
|
SWITCH: {
|
||||||
$key_type == 1 && do {
|
$key_type == 1 && do {
|
||||||
# 1 line only!!
|
# 1 line only!!
|
||||||
foreach (@key_file) {
|
foreach (@key_file) {
|
||||||
chomp;
|
chomp;
|
||||||
($key_algo, $key_line) = split (/ /);
|
($key_algo, $key_line) = split (/ /);
|
||||||
};
|
};
|
||||||
last SWITCH;
|
last SWITCH;
|
||||||
};
|
};
|
||||||
$key_type == 2 && do {
|
$key_type == 2 && do {
|
||||||
foreach (@key_file) {
|
foreach (@key_file) {
|
||||||
chomp;
|
chomp;
|
||||||
# skip BEGIN/END lines
|
# skip BEGIN/END lines
|
||||||
next if (/^----/);
|
next if (/^----/);
|
||||||
# skip Comment field
|
# skip Comment field
|
||||||
next if (/^Comment/);
|
next if (/^Comment/);
|
||||||
$key_line .= $_;
|
$key_line .= $_;
|
||||||
}
|
}
|
||||||
last SWITCH;
|
last SWITCH;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# mangle space in label
|
# mangle space in label
|
||||||
$key_label =~ tr/ /_/s;
|
$key_label =~ tr/ /_/s;
|
||||||
@ -152,7 +152,7 @@ convert_pubkey.pl - converts public keys for SSH controls format (SSH-RSA)
|
|||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
update_ssh.pl -f|--file=<public_key> -l|--label=<label_name>
|
update_ssh.pl -f|--file=<public_key> -l|--label=<label_name>
|
||||||
[-h|--help]
|
[-h|--help]
|
||||||
[-V|--version]
|
[-V|--version]
|
||||||
|
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ do
|
|||||||
log "child process ${PID} exited [OK]"
|
log "child process ${PID} exited [OK]"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# break loop if we no child PIDs left
|
# break loop if we have no child PIDs left
|
||||||
(($# > 0)) || break
|
(($# > 0)) || break
|
||||||
sleep 1 # required to avoid race conditions
|
sleep 1 # required to avoid race conditions
|
||||||
done
|
done
|
||||||
@ -941,17 +941,17 @@ done
|
|||||||
# check for configuration files (local overrides local)
|
# check for configuration files (local overrides local)
|
||||||
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" || -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
|
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" || -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
|
||||||
then
|
then
|
||||||
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" ]]
|
if [[ -r "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}" ]]
|
||||||
then
|
then
|
||||||
. "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}"
|
. "${SCRIPT_DIR}/${GLOBAL_CONFIG_FILE}"
|
||||||
fi
|
fi
|
||||||
if [[ -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
|
if [[ -r "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}" ]]
|
||||||
then
|
then
|
||||||
. "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}"
|
. "${SCRIPT_DIR}/${LOCAL_CONFIG_FILE}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
print -u2 "ERROR: could not find global or local configuration file"
|
print -u2 "ERROR: could not find global or local configuration file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# startup checks
|
# startup checks
|
||||||
check_params && check_config && check_setup && check_logging
|
check_params && check_config && check_setup && check_logging
|
||||||
@ -994,7 +994,7 @@ case ${ARG_ACTION} in
|
|||||||
# wait until all background processes are completed
|
# wait until all background processes are completed
|
||||||
wait_for_children ${PIDS} || \
|
wait_for_children ${PIDS} || \
|
||||||
warn "$? background jobs (possibly) failed to complete correctly"
|
warn "$? background jobs (possibly) failed to complete correctly"
|
||||||
PIDS=''
|
PIDS=''
|
||||||
# reset max updates in background
|
# reset max updates in background
|
||||||
COUNT=${MAX_BACKGROUND_PROCS}
|
COUNT=${MAX_BACKGROUND_PROCS}
|
||||||
fi
|
fi
|
||||||
@ -1036,7 +1036,7 @@ case ${ARG_ACTION} in
|
|||||||
warn "$? background jobs (possibly) failed to complete correctly"
|
warn "$? background jobs (possibly) failed to complete correctly"
|
||||||
PIDS=''
|
PIDS=''
|
||||||
# reset max updates in background
|
# reset max updates in background
|
||||||
COUNT=${MAX_BACKGROUND_PROCS}
|
COUNT=${MAX_BACKGROUND_PROCS}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# final wait for background processes to be finished completely
|
# final wait for background processes to be finished completely
|
||||||
|
@ -20,4 +20,4 @@ blacklist_file=/etc/kudos/ssh_controls/keys.blacklisted
|
|||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# End of FILE
|
# End of FILE
|
||||||
#******************************************************************************
|
#******************************************************************************
|
@ -545,7 +545,7 @@ unless ($preview) {
|
|||||||
last SWITCH_RELEASE;
|
last SWITCH_RELEASE;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# use fall back in case we cannot determine the version
|
# use fall back in case we cannot determine the version
|
||||||
if (not (defined ($linux_version)) or $linux_version eq "") {
|
if (not (defined ($linux_version)) or $linux_version eq "") {
|
||||||
$selinux_context = 'etc_t';
|
$selinux_context = 'etc_t';
|
||||||
@ -554,10 +554,10 @@ unless ($preview) {
|
|||||||
$selinux_context = $selinux_contexts{$linux_version};
|
$selinux_context = $selinux_contexts{$linux_version};
|
||||||
}
|
}
|
||||||
if ($has_selinux) {
|
if ($has_selinux) {
|
||||||
do_log ("INFO: runtime info: OS major version $linux_version, SELinux context $selinux_context on $hostname");
|
do_log ("INFO: runtime info: OS major version $linux_version, SELinux context $selinux_context on $hostname");
|
||||||
} else {
|
} else {
|
||||||
do_log ("INFO: runtime info: OS major version $linux_version on $hostname");
|
do_log ("INFO: runtime info: OS major version $linux_version on $hostname");
|
||||||
}
|
}
|
||||||
last SWITCH_OS;
|
last SWITCH_OS;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user