-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtools.mk
More file actions
executable file
·120 lines (101 loc) · 2.9 KB
/
tools.mk
File metadata and controls
executable file
·120 lines (101 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env -S make --file
SELF := $(lastword $(MAKEFILE_LIST))
include ./.env
SHELL := /usr/bin/env bash
.SHELLFLAGS := -o errexit -o errtrace -o nounset -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
# Taken from https://www.client9.com/self-documenting-makefiles/
help : ## Print this help
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST)
.PHONY : help
.DEFAULT_GOAL := help
rescan-disks : ## Scan for additional hard disks without restarting the virtual machine
sudo rescan-scsi-bus.sh
.PHONY : rescan-disks
network-interfaces : ## List network interfaces
ip link
.PHONY : network-interfaces
password : ## Generate a password
openssl rand -base64 32
.PHONY : password
monit : ## Print Monit status and summary
@echo Syntax-Check the Control File
sudo monit -t
@echo Status
sudo monit status
@echo Summary
sudo monit summary
.PHONY : monit
crontab : ## List user's and root's contab
crontab -l
sudo crontab -u root -l
.PHONY : crontab
job : ## Test run the command `${COMMAND}` in a Cron-like environment
env \
--ignore-environment \
HOME="$${HOME}" \
USER="$${USER}" \
PATH="/usr/local/bin/:/usr/bin:/bin" \
SHELL="/bin/sh" \
setsid \
${COMMAND} \
</dev/null \
>/tmp/cron_debug.log \
2>&1
cat /tmp/cron_debug.log
rm /tmp/cron_debug.log
.PHONY : job
# https://sshguard.net/docs/sshguard-setup.html
sshguard : ## Inspect SSHGuard
systemctl cat sshguard
cat /etc/sshguard/sshguard.conf
sudo nft list set ip sshguard attackers
sudo nft list set ip6 sshguard attackers
sudo nft list table ip sshguard
sudo nft list table ip6 sshguard
ansible-config : ## Dump Ansible config
ansible-config dump
ansible-config view
.PHONY : ansible-config
# Lint Ansible playbook without style rules
# ansible-lint \
# --config-file ./.ansible-lint \
# --skip-list "$$(echo $$(ansible-lint -L | awk -F':' '{print $$1}' | grep '^[^ ]') | tr ' ' ',')" \
# ./setup.yaml
lint-ansible : ## Lint Ansible
ansible-lint \
--config-file ./.ansible-lint \
./setup.yaml
.PHONY : lint-ansible
fix-ansible : ## Fix Ansible linting violations
ansible-lint \
--config-file ./.ansible-lint \
--fix \
./setup.yaml
.PHONY : fix-ansible
syntax-ansible : ## Syntax-check Ansible playbook
./ansible-playbook.sh \
--syntax-check \
./setup.yaml
.PHONY : syntax-ansible
dry-run-ansible : ## Dry-run Ansible playbook
./ansible-playbook.sh \
--check \
./setup.yaml
.PHONY : dry-run-ansible-run
validate-vector : ## Validate Vector configuration
sudo vector validate \
/etc/vector/vector.yaml
.PHONY : validate-vector
syntax-monit : ## Syntax-check Monit control file
sudo monit \
-t \
-c /etc/monit/monitrc
.PHONY : syntax-monit
check-msmtp : ## Check MSMTP configuration
msmtp --serverinfo
.PHONY : check-msmtp
check : lint-ansible syntax-ansible validate-vector syntax-monit check-msmtp ## Lint, syntax-check, and validate config files
.PHONY : check