Skip to content

Commit

Permalink
Username/Password re-use
Browse files Browse the repository at this point in the history
if the u/p has already been set, this will default to use those values
during configuration

Signed-off-by: Scott R. Shinn <[email protected]>
  • Loading branch information
atomicturtle committed Jan 15, 2022
1 parent c1fe587 commit 71bc870
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions oum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ show_updates() {
update_rules() {
local item

printf '\t%s\n' "Downloading Rule update: ${OSSEC_CRS_RULES_VERSION}"
printf '\n\t%s\n' "Downloading Rule update: ${OSSEC_CRS_RULES_VERSION}"

download https://$(encode_uri_component ${USERNAME}):$(encode_uri_component ${PASSWORD})@${SERVER}/channels/rules/ossec/ossec-crs-rules-${OSSEC_CRS_RULES_VERSION}.tar.gz ${OSSEC_HOME}/tmp/ossec-crs-rules-${OSSEC_CRS_RULES_VERSION}.tar.gz

Expand Down Expand Up @@ -310,7 +310,7 @@ update_rules() {
update_threatfeed() {
local item

printf '\t%s\n' "Downloading Atomicorp Threatfeed update: ${OSSEC_CRS_THREAT_VERSION}"
printf '\n\t%s\n' "Downloading Atomicorp Threatfeed update: ${OSSEC_CRS_THREAT_VERSION}"

download https://$(encode_uri_component ${USERNAME}):$(encode_uri_component ${PASSWORD})@${SERVER}/channels/rules/ossec/atomicorp-threatfeed-${OSSEC_CRS_THREAT_VERSION}.tar.gz ${OSSEC_HOME}/tmp/atomicorp-threatfeed-${OSSEC_CRS_THREAT_VERSION}.tar.gz

Expand Down Expand Up @@ -449,27 +449,33 @@ configure() {
cp -a ${conf_cur} ${conf_tmp}

# Prompt for Username
read -rp "Please enter your subscription username [Default: ] " user_tmp
read -rp "Please enter your subscription username [Default: ${USERNAME}]: " user_tmp

until [ -n "${user_tmp}" ]
do
if [[ ${USERNAME} ]] && [[ $user_tmp == "" ]]; then
user_tmp=${USERNAME}
fi

until [ -n "${user_tmp}" ]; do
print_error -ltp "Username cannot be blank."

read -rp "Please enter your subscription username [Default: ] " user_tmp
read -rp "Please enter your subscription username [Default: ${USERNAME}]: " user_tmp
done

sed -i '/USERNAME=.*/d' ${conf_cur}

echo "USERNAME=$(printf %q "${user_tmp}")" >${conf_tmp}

# Prompt for Password
read -rsp "Please enter your subscription password [Default: ] " pass_tmp
read -rsp "Please enter your subscription password [Default: ${PASSWORD}] " pass_tmp

until [ -n "${pass_tmp}" ]
do
if [[ ${PASSWORD} ]] && [[ $pass_tmp == "" ]]; then
pass_tmp=${PASSWORD}
fi

until [ -n "${pass_tmp}" ]; do
print_error -ltp "Password cannot be blank."

read -rsp "Please enter your subscription password [Default: ] " pass_tmp
read -rsp "Please enter your subscription password [Default: ${PASSWORD}] " pass_tmp
done

sed -i '/PASSWORD=.*/d' ${conf_cur}
Expand Down Expand Up @@ -564,7 +570,8 @@ case "${command}" in
install_package ${1}
;;
version)
printf '\n%s\n\n' "OUM Version: $VERSION"
printf '\n%s\n' "OSSEC Updater Modified (OUM) Version: $VERSION"
printf '%s\n\n' " Copyright Atomicorp, Inc. 2021"
;;
*)
show_help
Expand Down

0 comments on commit 71bc870

Please sign in to comment.