Skip to content

Commit

Permalink
[opensearch-logs] remove insecure flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuckkuck committed Jun 20, 2024
1 parent e5d86a8 commit d694a1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions system/opensearch-logs/templates/config/_index_cleanup.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#!/bin/bash

export HOST=https://opensearch-logs-client:9200
#job to delete wrongly created indexes, which have timestamps in the future
export HOST=https://opensearch-logs-client.{{ .Values.global.clusterType}}.{{ .Values.global.region }}.{{ .Values.global.tld }}:9200
export CLEANUP_INDEXES="kubernikus virtual scaleout"

export LC_ALL=C.UTF-8; export LANG=C.UTF-8

for i in ${CLEANUP_INDEXES}
do
export TO_DELETE_NEAR_FUTURE=`curl --insecure -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '20[0,1,3-9]'|awk '{ print $1}'|tr -d '"'`
export TO_DELETE_NEAR_FUTURE=`curl -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '20[0,1,3-9]'|awk '{ print $1}'|tr -d '"'`
for e in ${TO_DELETE_NEAR_FUTURE}
do
echo -e "Deleting index $e"
curl --insecure -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$e?pretty
curl -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$e?pretty
done
export TO_DELETE_FUTURE=`curl --insecure -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '2[1-9][0-9][0-9]'|awk '{ print $1}'|tr -d '"'`
export TO_DELETE_FUTURE=`curl -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '2[1-9][0-9][0-9]'|awk '{ print $1}'|tr -d '"'`
for p in ${TO_DELETE_FUTURE}
do
echo -e "Deleting index $p"
curl --insecure -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$p?pretty
curl -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$p?pretty
done
export TO_DELETE_PAST=`curl --insecure -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '19[0-9][0-9]'|awk '{ print $1}'|tr -d '"'`
export TO_DELETE_PAST=`curl -s -u "${ADMIN_USER}:${ADMIN_PASSWORD}" ${HOST}/_aliases?pretty=true|grep $i | grep '19[0-9][0-9]'|awk '{ print $1}'|tr -d '"'`
for d in ${TO_DELETE_FUTURE}
do
echo -e "Deleting index $d"
curl --insecure -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$d?pretty
curl -u "${ADMIN_USER}:${ADMIN_PASSWORD}" -X DELETE ${HOST}/$d?pretty
done
done
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# 0. Check for index policy
for i in $(curl -s --insecure -u ${ADMIN_USER}:${ADMIN_PASSWORD} "${CLUSTER_HOST}/_cat/indices?v"|awk '{ print $3 }'|awk -F- '{ print $1 }'|sort|uniq|grep -v "\."|grep -v "index")
for i in $(curl -s -u ${ADMIN_USER}:${ADMIN_PASSWORD} "${CLUSTER_HOST}/_cat/indices?v"|awk '{ print $3 }'|awk -F- '{ print $1 }'|sort|uniq|grep -v "\."|grep -v "index")
do
echo "using index $i from Opensearch-Logs"
echo "setting OpenSearch dashboard index mapping for index $i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
path: /_prometheus/metrics
scheme: https
tlsConfig:
insecureSkipVerify: true
insecureSkipVerify: false
port: http
basicAuth:
password:
Expand Down

0 comments on commit d694a1e

Please sign in to comment.