-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notes on how cert renewer (cron) was setup on data
- Loading branch information
Showing
1 changed file
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# | ||
# <meta:header> | ||
# <meta:licence> | ||
# Copyright (c) 2023, ROE (http://www.roe.ac.uk/) | ||
# | ||
# This information is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This information is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# </meta:licence> | ||
# </meta:header> | ||
# | ||
|
||
|
||
# Documentation on how to setup & use the certificate backup tool for Zeppelin (dmp.gaia.ac.uk) | ||
# Setup on [email protected] | ||
|
||
|
||
user=fedora | ||
|
||
# ----------------------- | ||
# Create directory for python app | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
sudo mkdir /opt/certrenewer | ||
sudo chmod 775 /opt/certrenewer/ | ||
sudo chown $user:root /opt/certrenewer/ | ||
|
||
|
||
# ----------------------- | ||
# Create logs directory | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
sudo mkdir /var/log/certbot/ | ||
sudo chown $user:root /var/log/certbot/ | ||
|
||
|
||
|
||
# ----------------------- | ||
# Clone certrenewer repo | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
git clone https://github.com/stvoutsin/certrenewer /opt/certrenewer | ||
|
||
|
||
# ----------------------- | ||
# Install requirements | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
# First Run the following pip upgrade | ||
pip3 install -U pip | ||
|
||
pushd /opt/certrenewer | ||
|
||
pip install -r requirements.txt | ||
|
||
popd | ||
|
||
|
||
#---------------- | ||
# Setup cron | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
# On Fedora | ||
|
||
yum install cronie | ||
yum install cronie-anacron | ||
|
||
|
||
# On Ubuntu | ||
|
||
apt-get install cron | ||
|
||
|
||
|
||
# Or, if using Ansible playbook : | ||
|
||
|
||
- name: "Setup Cron" | ||
hosts: local | ||
gather_facts: false | ||
tasks: | ||
- name: "Install Cron" | ||
become: true | ||
yum: | ||
name: | ||
- cronie | ||
- cronie-anacron | ||
update_cache: yes | ||
state: present | ||
|
||
- name: "Start Crond" | ||
service: | ||
name: crond | ||
state: restarted | ||
become: yes | ||
|
||
|
||
#---------------- | ||
# Setup cron | ||
# fedora@iris-gaia-data-20220411-gitstore | ||
|
||
crontab -e | ||
|
||
|
||
# Set to run every minute: | ||
0 0 * * * python3 /opt/certrenewer/certrenewer/certrenewer.py --zeppelin-host iris-gaia-blue.gaia-dmp.uk --zeppelin-user fedora --data-backup-dest /tmp/certs | ||
|
||
|
||
|
||
#---------------- | ||
# Check logs | ||
# user@local | ||
|
||
tail -f -n 1000 /var/log/certbot/app.log | ||
|
||
> | ||
2023-09-20 12:24:23,412 - INFO - Starting Renewal & Backup | ||
2023-09-20 12:24:24,823 - INFO - Updated 'latest' symlink to 20230920 | ||
2023-09-20 12:24:24,823 - INFO - Renewal completed successfully | ||
|
||
|
||
#------------------------------------------------ | ||
# Check that tar was copied over successfully | ||
# user@local | ||
|
||
ls -al /tmp/certs/latest/ | ||
total 72 | ||
|
||
.. Sep 19 15:44 certs.tar.gz | ||
|
||
|
||
# Success |