Skip to content

Commit

Permalink
Generate unique ip lists when conditions are met
Browse files Browse the repository at this point in the history
- See conditions here: #14532 (comment)
  • Loading branch information
DFolchA committed Oct 18, 2022
1 parent 7b05541 commit 7d38f36
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 272 deletions.
2 changes: 1 addition & 1 deletion src/init/register_configure_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ main () {
ADDRESSES=( ${WAZUH_MANAGER//,/ } )
PROTOCOLS=( $(tolower "${WAZUH_PROTOCOL//,/ }") )
# Get uniques values if all protocols are the same
if ( [ "${#PROTOCOLS[@]}" -ge "${#ADDRESSES[@]}" ] && ( ( ! echo "${PROTOCOLS[@]}" | grep -q -w "tcp" ) || ( ! echo "${PROTOCOLS[@]}" | grep -q -w "udp" ) ) ) || [ ${#PROTOCOLS[@]} -eq 0 ]; then
if ( [ "${#PROTOCOLS[@]}" -ge "${#ADDRESSES[@]}" ] && ( ( ! echo "${PROTOCOLS[@]}" | grep -q -w "tcp" ) || ( ! echo "${PROTOCOLS[@]}" | grep -q -w "udp" ) ) ) || [ ${#PROTOCOLS[@]} -eq 0 ] || ( ! echo "${PROTOCOLS[@]}" | grep -q -w "udp" ) ; then
ADDRESSES=( $(echo "${ADDRESSES[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ') )
fi

Expand Down

0 comments on commit 7d38f36

Please sign in to comment.