You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/03/30 21:55:18 UTC
[airavata] 01/02: Ansible: integrating zabbix for ssl domain
monitoring
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit d89bf14f001126c8eea064d3b2952ea0fc192df9
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Mar 30 17:54:31 2021 -0400
Ansible: integrating zabbix for ssl domain monitoring
---
dev-tools/ansible/roles/django/tasks/main.yml | 8 ++++++
.../roles/letsencrypt/tasks/files/check-domains.sh | 29 ++++++++++++++++++++++
dev-tools/ansible/roles/letsencrypt/tasks/main.yml | 8 ++++++
3 files changed, 45 insertions(+)
diff --git a/dev-tools/ansible/roles/django/tasks/main.yml b/dev-tools/ansible/roles/django/tasks/main.yml
index 007b448..935b973 100644
--- a/dev-tools/ansible/roles/django/tasks/main.yml
+++ b/dev-tools/ansible/roles/django/tasks/main.yml
@@ -310,3 +310,11 @@
state: absent
path: "{{ airavata_django_portal_tempdir.path }}"
run_once: true
+
+- name: add domain to Zabbix monitoring checklist
+ lineinfile:
+ path: /etc/zabbix/domain_checklist
+ line: "{{ vhost_servername }}"
+ create: yes
+ become: yes
+ when: vhost_ssl
diff --git a/dev-tools/ansible/roles/letsencrypt/tasks/files/check-domains.sh b/dev-tools/ansible/roles/letsencrypt/tasks/files/check-domains.sh
new file mode 100644
index 0000000..467c285
--- /dev/null
+++ b/dev-tools/ansible/roles/letsencrypt/tasks/files/check-domains.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+DOMAIN_CHECKLIST=/etc/zabbix/domain_checklist
+EXPIRES_IN_DAYS=28
+
+while IFS="" read domain; do
+ data=`echo |openssl s_client -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -noout -checkend $(( $EXPIRES_IN_DAYS * 86400 )) 2>/dev/null && echo good || echo "$domain expires in less than $EXPIRES_IN_DAYS days"`
+ if [ "$data" != "good" ]; then
+ echo $data
+ fi
+done < $DOMAIN_CHECKLIST
diff --git a/dev-tools/ansible/roles/letsencrypt/tasks/main.yml b/dev-tools/ansible/roles/letsencrypt/tasks/main.yml
index 2f6ea87..afb118d 100644
--- a/dev-tools/ansible/roles/letsencrypt/tasks/main.yml
+++ b/dev-tools/ansible/roles/letsencrypt/tasks/main.yml
@@ -64,3 +64,11 @@
become: true
become_user: root
when: ansible_os_family == "RedHat"
+
+- name: copy check-domains.sh script (Zabbix remote command)
+ copy:
+ src: check-domains.sh
+ dest: /usr/local/bin/check-domains.sh
+ mode: 0755
+ become: yes
+ become_user: root