Initial commit of PVC Ansible role
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Ansible fact - dhcp_status
|
||||
# {{ ansible_managed }}
|
||||
DHCP_STATUS="$( grep -o 'dhcp' /etc/network/interfaces | uniq )"
|
||||
echo "\"${DHCP_STATUS}\""
|
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Ansible fact - host_group
|
||||
# {{ ansible_managed }}
|
||||
HOST_GROUP="$( hostname -s | sed 's/[0-9]*//g' )"
|
||||
echo "\"${HOST_GROUP}\""
|
8
roles/base/templates/etc/ansible/facts.d/host_id.fact.j2
Normal file
8
roles/base/templates/etc/ansible/facts.d/host_id.fact.j2
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# Ansible fact - host_id
|
||||
# {{ ansible_managed }}
|
||||
HOST_ID="$( hostname -s | grep -o '[0-9]\+' )"
|
||||
if [[ -z ${HOST_ID} ]]; then
|
||||
HOST_ID="0"
|
||||
fi
|
||||
echo "\"${HOST_ID}\""
|
@ -0,0 +1,5 @@
|
||||
# apt configuration: disable recommends
|
||||
# {{ ansible_managed }}
|
||||
|
||||
APT::Install-Recommends "0";
|
||||
APT::Install-Suggests "0";
|
@ -0,0 +1,37 @@
|
||||
# Unattended upgrades configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Unattended-Upgrade::Origins-Pattern {
|
||||
"origin=Debian,codename=${distro_codename},label=Debian";
|
||||
"origin=Debian,codename=${distro_codename},label=Debian-Security";
|
||||
};
|
||||
|
||||
Unattended-Upgrade::Package-Blacklist {
|
||||
# "libc6$";
|
||||
# "libc6-dev$";
|
||||
# "libc6-i686$";
|
||||
};
|
||||
|
||||
# General configurations
|
||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||
Unattended-Upgrade::MinimalSteps "true";
|
||||
Unattended-Upgrade::InstallOnShutdown "false";
|
||||
Unattended-Upgrade::Mail "root@bonilan.net";
|
||||
Unattended-Upgrade::MailOnlyOnError "true";
|
||||
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
|
||||
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
||||
Unattended-Upgrade::SyslogEnable "true";
|
||||
Unattended-Upgrade::SyslogFacility "daemon";
|
||||
Unattended-Upgrade::Verbose "false";
|
||||
Unattended-Upgrade::Debug "false";
|
||||
|
||||
# Reboot configurations - skip cephX and hvX
|
||||
{% if 'hv' in group_names or 'ceph' in group_names %}
|
||||
Unattended-Upgrade::Automatic-Reboot "false";
|
||||
{% else %}
|
||||
Unattended-Upgrade::Automatic-Reboot "true";
|
||||
Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
|
||||
{% set reboot_time_minute = 2 * ansible_local.host_id|int %}
|
||||
Unattended-Upgrade::Automatic-Reboot-Time "04:{{ '%02d' % reboot_time_minute }}";
|
||||
{% endif %}
|
12
roles/base/templates/etc/apt/preferences.d/pins.j2
Normal file
12
roles/base/templates/etc/apt/preferences.d/pins.j2
Normal file
@ -0,0 +1,12 @@
|
||||
# apt configuration: pinning preferences
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Package: *
|
||||
Pin: release a={{ ansible_distribution_release }}
|
||||
Pin-Priority: 999
|
||||
|
||||
{% if 'base' in group_names %}
|
||||
Package: *
|
||||
Pin: release a={{ ansible_distribution_release }}-backports
|
||||
Pin-Priority: -1
|
||||
{% endif %}
|
14
roles/base/templates/etc/apt/sources.list.x86_64.j2
Normal file
14
roles/base/templates/etc/apt/sources.list.x86_64.j2
Normal file
@ -0,0 +1,14 @@
|
||||
# apt configuration: main sources list
|
||||
# {{ ansible_managed }}
|
||||
|
||||
deb http://debian.mirror.rafal.ca/debian {{ ansible_distribution_release }} main contrib non-free
|
||||
deb-src http://debian.mirror.rafal.ca/debian {{ ansible_distribution_release }} main contrib
|
||||
|
||||
deb http://security.debian.org/ {{ ansible_distribution_release }}/updates main contrib
|
||||
deb-src http://security.debian.org/ {{ ansible_distribution_release }}/updates main contrib
|
||||
|
||||
deb http://debian.mirror.rafal.ca/debian/ {{ ansible_distribution_release }}-updates main contrib
|
||||
deb-src http://debian.mirror.rafal.ca/debian/ {{ ansible_distribution_release }}-updates main contrib
|
||||
|
||||
deb https://repo.bonifacelabs.net/debian/ {{ ansible_distribution_release }}-updates main
|
||||
deb-src https://repo.bonifacelabs.net/debian/ {{ ansible_distribution_release }}-updates main
|
126
roles/base/templates/etc/bash.bashrc.j2
Executable file
126
roles/base/templates/etc/bash.bashrc.j2
Executable file
@ -0,0 +1,126 @@
|
||||
# System-wide .bashrc file for interactive bash(1) shells.
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# To enable the settings / commands in this file for login shells as well,
|
||||
# this file has to be sourced in /etc/profile.
|
||||
|
||||
# Fix the preceeding space stupidity
|
||||
export HISTCONTROL=ignorespace
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Returncode.
|
||||
#------------------------------------------------------------------------------
|
||||
function returncode
|
||||
{
|
||||
returncode=$?
|
||||
if [ $returncode != 0 ]; then
|
||||
echo "[$returncode]"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
alias ll='ls -al'
|
||||
|
||||
use_color=false
|
||||
|
||||
# Set colorful PS1 only on colorful terminals.
|
||||
# dircolors --print-database uses its own built-in database
|
||||
# instead of using /etc/DIR_COLORS. Try to use the external file
|
||||
# first to take advantage of user additions. Use internal bash
|
||||
# globbing instead of external grep binary.
|
||||
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
|
||||
match_lhs=""
|
||||
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
|
||||
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
|
||||
[[ -z ${match_lhs} ]] \
|
||||
&& type -P dircolors >/dev/null \
|
||||
&& match_lhs=$(dircolors --print-database)
|
||||
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
|
||||
|
||||
if ${use_color} ; then
|
||||
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
|
||||
if type -P dircolors >/dev/null ; then
|
||||
if [[ -f ~/.dir_colors ]] ; then
|
||||
eval $(dircolors -b ~/.dir_colors)
|
||||
elif [[ -f /etc/DIR_COLORS ]] ; then
|
||||
eval $(dircolors -b /etc/DIR_COLORS)
|
||||
else
|
||||
eval $(dircolors)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
PS1='\[\033[0;31m\]$(returncode)\[\033[0;37m\]\[\033[0;35m\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\H\[\033[01;34m\] \w \$\[\033[00m\] '
|
||||
elif [[ ${UID} == 200 ]] ; then
|
||||
PS1='\[\033[0;31m\]$(returncode)\[\033[0;37m\]\[\033[0;35m\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\H\[\033[01;34m\] \w \$\[\033[00m\] '
|
||||
else
|
||||
PS1='\[\033[0;31m\]$(returncode)\[\033[0;37m\]\[\033[0;35m\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\H\[\033[01;34m\] \w \$\[\033[00m\] '
|
||||
fi
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --colour=auto'
|
||||
alias fgrep='fgrep --colour=auto'
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias ll='ls -lF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
else
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
# show root@ when we don't have colors
|
||||
PS1='\[$(returncode)\]\u@\H \w \$ '
|
||||
else
|
||||
PS1='\[$(returncode)\]\u@\H \w \$ '
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try to keep environment pollution down, EPA loves us.
|
||||
unset use_color safe_term match_lhs
|
||||
|
||||
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
#case "$TERM" in
|
||||
#xterm*|rxvt*)
|
||||
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
|
||||
# ;;
|
||||
#*)
|
||||
# ;;
|
||||
#esac
|
||||
|
||||
# enable bash completion in interactive shells
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# if the command-not-found package is installed, use it
|
||||
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
|
||||
function command_not_found_handle {
|
||||
# check because c-n-f could've been removed in the meantime
|
||||
if [ -x /usr/lib/command-not-found ]; then
|
||||
/usr/bin/python /usr/lib/command-not-found -- "$1"
|
||||
return $?
|
||||
elif [ -x /usr/share/command-not-found/command-not-found ]; then
|
||||
/usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"
|
||||
return $?
|
||||
else
|
||||
printf "%s: command not found\n" "$1" >&2
|
||||
return 127
|
||||
fi
|
||||
}
|
||||
fi
|
58
roles/base/templates/etc/check_mk/logwatch.cfg.j2
Normal file
58
roles/base/templates/etc/check_mk/logwatch.cfg.j2
Normal file
@ -0,0 +1,58 @@
|
||||
# +------------------------------------------------------------------+
|
||||
# | ____ _ _ __ __ _ __ |
|
||||
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||
# | |
|
||||
# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
|
||||
# +------------------------------------------------------------------+
|
||||
#
|
||||
# This file is part of Check_MK.
|
||||
# The official homepage is at http://mathias-kettner.de/check_mk.
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
# check_mk 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 in version 2. check_mk is distributed
|
||||
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
|
||||
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
|
||||
# ails. You should have received a copy of the GNU General Public
|
||||
# License along with GNU Make; see the file COPYING. If not, write
|
||||
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
# Boston, MA 02110-1301 USA.
|
||||
|
||||
# logwatch.cfg
|
||||
# This file configures mk_logwatch. Define your logfiles
|
||||
# and patterns to be looked for here.
|
||||
|
||||
# Name one or more logfiles
|
||||
/var/log/system.log /var/log/daemon.log
|
||||
# Patterns are indented with one space are prefixed with:
|
||||
# C: Critical messages
|
||||
# W: Warning messages
|
||||
# I: ignore these lines (OK)
|
||||
# The first match decided. Lines that do not match any pattern
|
||||
# are ignored
|
||||
C Fail event detected on md device
|
||||
I mdadm.*: Rebuild.*event detected
|
||||
W mdadm\[
|
||||
W ata.*hard resetting link
|
||||
W ata.*soft reset failed (.*FIS failed)
|
||||
W device-mapper: thin:.*reached low water mark
|
||||
C device-mapper: thin:.*no free space
|
||||
|
||||
/var/log/auth.log
|
||||
W sshd.*Corrupted MAC on input
|
||||
|
||||
/var/log/kern.log
|
||||
C panic
|
||||
C Oops
|
||||
W generic protection rip
|
||||
W .*Unrecovered read error - auto reallocate failed
|
||||
|
||||
# Globbing patterns are allowed:
|
||||
# /sapdata/*/saptrans.log
|
||||
# C ORA-
|
4
roles/base/templates/etc/cron.d/update-motd.j2
Normal file
4
roles/base/templates/etc/cron.d/update-motd.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# cron file for motd
|
||||
# {{ ansible_managed }}
|
||||
|
||||
* * * * * root /bin/sh /usr/local/sbin/update-motd.sh &>/dev/null
|
12
roles/base/templates/etc/crontab.j2
Normal file
12
roles/base/templates/etc/crontab.j2
Normal file
@ -0,0 +1,12 @@
|
||||
# /etc/crontab: system-wide crontab
|
||||
# {{ ansible_managed }}
|
||||
|
||||
SHELL=/bin/sh
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# m h dom mon dow user command
|
||||
00 * * * * root cd / && run-parts --report /etc/cron.hourly
|
||||
05 0 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
|
||||
15 0 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
|
||||
30 0 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
|
||||
#
|
4
roles/base/templates/etc/default/locale.j2
Normal file
4
roles/base/templates/etc/default/locale.j2
Normal file
@ -0,0 +1,4 @@
|
||||
LANGUAGE=en_CA.UTF-8
|
||||
LC_ALL=en_CA.UTF-8
|
||||
LANG=en_CA.UTF-8
|
||||
LC_TYPE=en_CA.UTF-8
|
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Disasble resolv.conf generation from DHCP
|
||||
# {{ ansible_managed }}
|
||||
make_resolv_conf() {
|
||||
:
|
||||
}
|
15
roles/base/templates/etc/fail2ban/action.d/route.conf.j2
Normal file
15
roles/base/templates/etc/fail2ban/action.d/route.conf.j2
Normal file
@ -0,0 +1,15 @@
|
||||
# fail2ban action - route
|
||||
|
||||
[Definition]
|
||||
actionban = ip route add <blocktype> <ip>
|
||||
actionunban = ip route del <blocktype> <ip>
|
||||
actioncheck =
|
||||
actionstart =
|
||||
actionstop =
|
||||
|
||||
[Init]
|
||||
|
||||
# Option: blocktype
|
||||
# Note: Type can be blackhole, unreachable and prohibit. Unreachable and prohibit correspond to the ICMP reject messages.
|
||||
# Values: STRING
|
||||
blocktype = blackhole
|
50
roles/base/templates/etc/fail2ban/filter.d/sshd.conf.j2
Normal file
50
roles/base/templates/etc/fail2ban/filter.d/sshd.conf.j2
Normal file
@ -0,0 +1,50 @@
|
||||
# Fail2Ban filter for openssh
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[INCLUDES]
|
||||
|
||||
# Read common prefixes. If any customizations available -- read them from
|
||||
# common.local
|
||||
before = common.conf
|
||||
|
||||
[Definition]
|
||||
|
||||
_daemon = sshd
|
||||
|
||||
failregex = ^%(__prefix_line)s(?:error: PAM: )?[aA]uthentication (?:failure|error|failed) for .* from <HOST>( via \S+)?\s*$
|
||||
^%(__prefix_line)s(?:error: PAM: )?User not known to the underlying authentication module for .* from <HOST>\s*$
|
||||
^%(__prefix_line)sFailed \S+ for (?P<cond_inv>invalid user )?(?P<user>(?P<cond_user>\S+)|(?(cond_inv)(?:(?! from ).)*?|[^:]+)) from <HOST>(?: port \d+)?(?: ssh\d*)?(?(cond_user):|(?:(?:(?! from ).)*)$)
|
||||
^%(__prefix_line)sROOT LOGIN REFUSED.* FROM <HOST>\s*$
|
||||
^%(__prefix_line)s[iI](?:llegal|nvalid) user .*? from <HOST>(?: port \d+)?\s*$
|
||||
^%(__prefix_line)sUser .+ from <HOST> not allowed because not listed in AllowUsers\s*$
|
||||
^%(__prefix_line)sUser .+ from <HOST> not allowed because listed in DenyUsers\s*$
|
||||
^%(__prefix_line)sUser .+ from <HOST> not allowed because not in any group\s*$
|
||||
^%(__prefix_line)srefused connect from \S+ \(<HOST>\)\s*$
|
||||
^%(__prefix_line)s(?:error: )?Received disconnect from <HOST>: 3: .*: Auth fail(?: \[preauth\])?$
|
||||
^%(__prefix_line)sUser .+ from <HOST> not allowed because a group is listed in DenyGroups\s*$
|
||||
^%(__prefix_line)sUser .+ from <HOST> not allowed because none of user's groups are listed in AllowGroups\s*$
|
||||
^(?P<__prefix>%(__prefix_line)s)User .+ not allowed because account is locked<SKIPLINES>(?P=__prefix)(?:error: )?Received disconnect from <HOST>: 11: .+ \[preauth\]$
|
||||
^(?P<__prefix>%(__prefix_line)s)Disconnecting: Too many authentication failures for .+? \[preauth\]<SKIPLINES>(?P=__prefix)(?:error: )?Connection closed by <HOST> \[preauth\]$
|
||||
^(?P<__prefix>%(__prefix_line)s)Connection from <HOST> port \d+(?: on \S+ port \d+)?<SKIPLINES>(?P=__prefix)Disconnecting: Too many authentication failures for .+? \[preauth\]$
|
||||
^%(__prefix_line)s(error: )?maximum authentication attempts exceeded for .* from <HOST>(?: port \d*)?(?: ssh\d*)? \[preauth\]$
|
||||
^%(__prefix_line)spam_unix\(sshd:auth\):\s+authentication failure;\s*logname=\S*\s*uid=\d*\s*euid=\d*\s*tty=\S*\s*ruser=\S*\s*rhost=<HOST>\s.*$
|
||||
^%(__prefix_line)sUnable to negotiate with <HOST> .*$
|
||||
|
||||
ignoreregex =
|
||||
|
||||
[Init]
|
||||
|
||||
# "maxlines" is number of log lines to buffer for multi-line regex searches
|
||||
maxlines = 10
|
||||
|
||||
journalmatch = _SYSTEMD_UNIT=sshd.service + _COMM=sshd
|
||||
|
||||
# DEV Notes:
|
||||
#
|
||||
# "Failed \S+ for .*? from <HOST>..." failregex uses non-greedy catch-all because
|
||||
# it is coming before use of <HOST> which is not hard-anchored at the end as well,
|
||||
# and later catch-all's could contain user-provided input, which need to be greedily
|
||||
# matched away first.
|
||||
#
|
||||
# Author: Cyril Jaquier, Yaroslav Halchenko, Petr Voralek, Daniel Black
|
||||
|
30
roles/base/templates/etc/fail2ban/jail.d/sshd.conf.j2
Normal file
30
roles/base/templates/etc/fail2ban/jail.d/sshd.conf.j2
Normal file
@ -0,0 +1,30 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Author: Wolfgang Karall (based on sshd.conf from Cyril Jaquier)
|
||||
#
|
||||
|
||||
[INCLUDES]
|
||||
|
||||
# Read common prefixes. If any customizations available -- read them from
|
||||
# common.local
|
||||
before = common.conf
|
||||
|
||||
|
||||
[Definition]
|
||||
|
||||
_daemon = sshd
|
||||
|
||||
# Option: failregex
|
||||
# Notes.: regex to match the password failures messages in the logfile. The
|
||||
# host must be matched by a group named "host". The tag "<HOST>" can
|
||||
# be used for standard IP/hostname matching and is only an alias for
|
||||
# (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
|
||||
# Values: TEXT
|
||||
#
|
||||
failregex = ^%(__prefix_line)sUnable to negotiate with <HOST> .*$
|
||||
|
||||
# Option: ignoreregex
|
||||
# Notes.: regex to ignore. If this regex matches, the line is ignored.
|
||||
# Values: TEXT
|
||||
#
|
||||
ignoreregex = ^%(__prefix_line)sDid not receive identification string from .*$
|
11
roles/base/templates/etc/fail2ban/jail.d/sshd.local.j2
Normal file
11
roles/base/templates/etc/fail2ban/jail.d/sshd.local.j2
Normal file
@ -0,0 +1,11 @@
|
||||
[DEFAULT]
|
||||
maxretry = 3
|
||||
bantime = 14400
|
||||
ignoreip = 127.0.0.0/8 10.0.0.0/8 198.55.48.48/28
|
||||
|
||||
[ssh]
|
||||
enabled = true
|
||||
filter = sshd
|
||||
action = route
|
||||
logpath = /var/log/auth.log
|
||||
|
6
roles/base/templates/etc/hosts.j2
Normal file
6
roles/base/templates/etc/hosts.j2
Normal file
@ -0,0 +1,6 @@
|
||||
# Local system hosts file
|
||||
# {{ ansible_managed }}
|
||||
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
ff02::1 ip6-allmodes
|
||||
ff02::2 ip6-allrouters
|
4
roles/base/templates/etc/locale.gen.j2
Normal file
4
roles/base/templates/etc/locale.gen.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# Locales configuration file
|
||||
# {{ ansible_managed }}
|
||||
|
||||
en_CA.UTF-8 UTF-8
|
23
roles/base/templates/etc/logrotate.d/rsyslog-loghost.j2
Normal file
23
roles/base/templates/etc/logrotate.d/rsyslog-loghost.j2
Normal file
@ -0,0 +1,23 @@
|
||||
# Logrotate configuration for loghost archives
|
||||
# {{ ansible_managed }}
|
||||
|
||||
/srv/log/kern.log
|
||||
/srv/log/daemon.log
|
||||
/srv/log/haproxy.log
|
||||
/srv/log/auth.log
|
||||
/srv/log/cron.log
|
||||
/srv/log/mail.log
|
||||
/srv/log/boot.log
|
||||
/srv/log/system.log
|
||||
{
|
||||
weekly
|
||||
missingok
|
||||
copytruncate
|
||||
dateext
|
||||
notifempty
|
||||
sharedscripts
|
||||
postrotate
|
||||
/usr/lib/rsyslog/rsyslog-rotate &>/dev/null
|
||||
/usr/local/sbin/loghost-archive.sh &>/dev/null
|
||||
endscript
|
||||
}
|
23
roles/base/templates/etc/logrotate.d/rsyslog.j2
Normal file
23
roles/base/templates/etc/logrotate.d/rsyslog.j2
Normal file
@ -0,0 +1,23 @@
|
||||
# Logrotate configuration for standard log files
|
||||
# {{ ansible_managed }}
|
||||
|
||||
/var/log/kern.log
|
||||
/var/log/daemon.log
|
||||
/var/log/haproxy.log
|
||||
/var/log/auth.log
|
||||
/var/log/cron.log
|
||||
/var/log/mail.log
|
||||
/var/log/boot.log
|
||||
/var/log/system.log
|
||||
{
|
||||
rotate {{ logrotate_keepcount }}
|
||||
{{ logrotate_interval }}
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
sharedscripts
|
||||
postrotate
|
||||
/usr/lib/rsyslog/rsyslog-rotate &>/dev/null
|
||||
endscript
|
||||
}
|
27
roles/base/templates/etc/ntp.conf.j2
Normal file
27
roles/base/templates/etc/ntp.conf.j2
Normal file
@ -0,0 +1,27 @@
|
||||
# Main NTP configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
driftfile /var/lib/ntp/ntp.drift
|
||||
|
||||
statistics loopstats peerstats clockstats
|
||||
|
||||
filegen loopstats file loopstats type day enable
|
||||
filegen peerstats file peerstats type day enable
|
||||
filegen clockstats file clockstats type day enable
|
||||
|
||||
{% if 'remote' in group_names or 'remote-jellyfin' in group_names %}
|
||||
server time.nrc.ca
|
||||
server time.chu.nrc.ca
|
||||
|
||||
restrict -4 default kod notrap nomodify nopeer
|
||||
restrict -6 default kod notrap nomodify nopeer
|
||||
{% else %}
|
||||
disable auth
|
||||
multicastclient 224.0.0.1
|
||||
multicastclient ff05::101
|
||||
|
||||
restrict -4 default notrap nomodify
|
||||
restrict -6 default notrap nomodify
|
||||
{% endif %}
|
||||
restrict 127.0.0.1
|
||||
restrict ::1
|
54
roles/base/templates/etc/pam.d/sshd.j2
Normal file
54
roles/base/templates/etc/pam.d/sshd.j2
Normal file
@ -0,0 +1,54 @@
|
||||
# PAM configuration for the Secure Shell service
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Standard Un*x authentication.
|
||||
@include common-auth
|
||||
|
||||
# Disallow non-root logins when /etc/nologin exists.
|
||||
account required pam_nologin.so
|
||||
|
||||
# Uncomment and edit /etc/security/access.conf if you need to set complex
|
||||
# access limits that are hard to express in sshd_config.
|
||||
# account required pam_access.so
|
||||
|
||||
# Standard Un*x authorization.
|
||||
@include common-account
|
||||
|
||||
# SELinux needs to be the first session rule. This ensures that any
|
||||
# lingering context has been cleared. Without this it is possible that a
|
||||
# module could execute code in the wrong domain.
|
||||
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
|
||||
|
||||
# Set the loginuid process attribute.
|
||||
session required pam_loginuid.so
|
||||
|
||||
# Create a new session keyring.
|
||||
session optional pam_keyinit.so force revoke
|
||||
|
||||
# Standard Un*x session setup and teardown.
|
||||
@include common-session
|
||||
|
||||
# Print the message of the day upon successful login.
|
||||
session optional pam_motd.so motd=/run/pvc-motd.dynamic
|
||||
session optional pam_motd.so noupdate
|
||||
|
||||
# Print the status of the user's mailbox upon successful login.
|
||||
#session optional pam_mail.so standard noenv # [1]
|
||||
|
||||
# Set up user limits from /etc/security/limits.conf.
|
||||
session required pam_limits.so
|
||||
|
||||
# Read environment variables from /etc/environment and
|
||||
# /etc/security/pam_env.conf.
|
||||
session required pam_env.so # [1]
|
||||
# In Debian 4.0 (etch), locale-related environment variables were moved to
|
||||
# /etc/default/locale, so read that as well.
|
||||
session required pam_env.so user_readenv=1 envfile=/etc/default/locale
|
||||
|
||||
# SELinux needs to intervene at login time to ensure that the process starts
|
||||
# in the proper default security context. Only sessions which are intended
|
||||
# to run in the user's context should be run after this.
|
||||
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
|
||||
|
||||
# Standard Un*x password updating.
|
||||
@include common-password
|
17
roles/base/templates/etc/postfix/main.cf.j2
Normal file
17
roles/base/templates/etc/postfix/main.cf.j2
Normal file
@ -0,0 +1,17 @@
|
||||
# Postfix main configuration for non-MTA hosts
|
||||
# {{ ansible_managed }}
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
biff = no
|
||||
append_dot_mydomain = no
|
||||
readme_directory = no
|
||||
smtpd_use_tls=no
|
||||
|
||||
alias_maps = hash:/etc/postfix/aliases
|
||||
alias_database = hash:/etc/postfix/aliases
|
||||
mydestination =
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = 127.0.0.1
|
||||
inet_protocols = ipv4
|
7
roles/base/templates/etc/profile.d/w.sh.j2
Normal file
7
roles/base/templates/etc/profile.d/w.sh.j2
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Message of the day script to print active users
|
||||
# {{ ansible_managed }}
|
||||
|
||||
export PROCPS_FROMLEN=36 PROCPS_USERLEN=12
|
||||
w
|
5
roles/base/templates/etc/resolv.conf.j2
Normal file
5
roles/base/templates/etc/resolv.conf.j2
Normal file
@ -0,0 +1,5 @@
|
||||
# DNS resolver configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
options timeout:1 attempts:3 rotate
|
||||
nameserver 1.1.1.1
|
37
roles/base/templates/etc/rsyslog.conf.j2
Normal file
37
roles/base/templates/etc/rsyslog.conf.j2
Normal file
@ -0,0 +1,37 @@
|
||||
# Main rsyslog configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
#### ####
|
||||
#### MODULES ####
|
||||
#### ####
|
||||
|
||||
module(load="imuxsock") # provides support for local system logging (e.g. via logger command)
|
||||
module(load="imklog") # provides kernel logging support (previously done by rklogd)
|
||||
|
||||
$ModLoad imudp
|
||||
$UDPServerAddress ::1
|
||||
$UDPServerRun 514
|
||||
|
||||
#### ####
|
||||
#### GLOBAL DIRECTIVES ####
|
||||
#### ####
|
||||
|
||||
$PreserveFQDN on
|
||||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
|
||||
|
||||
#### ####
|
||||
#### RULES ####
|
||||
#### ####
|
||||
|
||||
ruleset(name="local") {
|
||||
kern.* /var/log/kern.log
|
||||
auth,authpriv.* /var/log/auth.log
|
||||
cron.* /var/log/cron.log
|
||||
daemon,user.* /var/log/daemon.log
|
||||
mail.* /var/log/mail.log
|
||||
local5.* /var/log/nginx.log
|
||||
local6.* /var/log/haproxy.log
|
||||
local7.* /var/log/boot.log
|
||||
*.info;kern,daemon,user,auth,authpriv,cron,mail,local6.none,local7.none /var/log/system.log
|
||||
}
|
||||
$DefaultRuleset local
|
3
roles/base/templates/etc/ssh/shosts.equiv.j2
Normal file
3
roles/base/templates/etc/ssh/shosts.equiv.j2
Normal file
@ -0,0 +1,3 @@
|
||||
# SSH remote allowed hosts
|
||||
# {{ ansible_managed }}
|
||||
|
43
roles/base/templates/etc/ssh/ssh_config.j2
Normal file
43
roles/base/templates/etc/ssh/ssh_config.j2
Normal file
@ -0,0 +1,43 @@
|
||||
# Default SSH client configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Host *
|
||||
# ForwardAgent no
|
||||
# ForwardX11 no
|
||||
# ForwardX11Trusted yes
|
||||
# RhostsRSAAuthentication no
|
||||
# RSAAuthentication yes
|
||||
# PasswordAuthentication yes
|
||||
# EnableSSHKeysign yes
|
||||
# HostbasedAuthentication yes
|
||||
# GSSAPIAuthentication no
|
||||
# GSSAPIDelegateCredentials no
|
||||
# GSSAPIKeyExchange no
|
||||
# GSSAPITrustDNS no
|
||||
# BatchMode no
|
||||
# CheckHostIP yes
|
||||
# AddressFamily any
|
||||
# ConnectTimeout 0
|
||||
# StrictHostKeyChecking ask
|
||||
# IdentityFile ~/.ssh/identity
|
||||
# IdentityFile ~/.ssh/id_rsa
|
||||
# IdentityFile ~/.ssh/id_dsa
|
||||
# Port 22
|
||||
# Protocol 2,1
|
||||
# Cipher 3des
|
||||
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
|
||||
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
|
||||
# EscapeChar ~
|
||||
# Tunnel no
|
||||
# TunnelDevice any:any
|
||||
# PermitLocalCommand no
|
||||
# VisualHostKey no
|
||||
# ProxyCommand ssh -q -W %h:%p gateway.example.com
|
||||
# PreferredAuthentications hostbased,pubkey
|
||||
SendEnv LANG LC_*
|
||||
HashKnownHosts yes
|
||||
GSSAPIAuthentication yes
|
||||
GSSAPIDelegateCredentials no
|
||||
PubkeyAuthentication yes
|
||||
HostbasedAuthentication yes
|
||||
EnableSSHKeysign yes
|
3
roles/base/templates/etc/ssh/ssh_known_hosts.j2
Normal file
3
roles/base/templates/etc/ssh/ssh_known_hosts.j2
Normal file
@ -0,0 +1,3 @@
|
||||
# SSH remote allowed hosts
|
||||
# {{ ansible_managed }}
|
||||
|
43
roles/base/templates/etc/ssh/sshd_config.j2
Normal file
43
roles/base/templates/etc/ssh/sshd_config.j2
Normal file
@ -0,0 +1,43 @@
|
||||
# Main SSH daemon configuraton
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Port 22
|
||||
ListenAddress ::
|
||||
ListenAddress 0.0.0.0
|
||||
Protocol 2
|
||||
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
UsePrivilegeSeparation yes
|
||||
SyslogFacility AUTH
|
||||
LogLevel INFO
|
||||
LoginGraceTime 120
|
||||
UsePAM yes
|
||||
StrictModes yes
|
||||
X11Forwarding no
|
||||
PrintMotd no
|
||||
PrintLastLog yes
|
||||
TCPKeepAlive yes
|
||||
AcceptEnv LANG LC_*
|
||||
|
||||
MACs hmac-sha2-512,hmac-sha2-256
|
||||
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
|
||||
|
||||
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
|
||||
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
|
||||
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
|
||||
|
||||
PubkeyAuthentication yes
|
||||
PermitEmptyPasswords no
|
||||
ChallengeResponseAuthentication no
|
||||
PasswordAuthentication no
|
||||
{% if 'hv' in group_names %}
|
||||
HostbasedAuthentication yes
|
||||
HostbasedUsesNameFromPacketOnly yes
|
||||
IgnoreRhosts no
|
||||
PermitRootLogin yes
|
||||
{% else %}
|
||||
HostbasedAuthentication no
|
||||
IgnoreRhosts yes
|
||||
PermitRootLogin no
|
||||
{% endif %}
|
||||
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server -f AUTH -l INFO
|
5
roles/base/templates/etc/sudoers.d/sudoers-backup.j2
Normal file
5
roles/base/templates/etc/sudoers.d/sudoers-backup.j2
Normal file
@ -0,0 +1,5 @@
|
||||
# sudoers configuraton for BackupPC
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Cmnd_Alias BACKUPS = /usr/bin/rsync, /var/backups/timestamp.sh
|
||||
backup ALL=(root) NOPASSWD: BACKUPS
|
12
roles/base/templates/etc/sudoers.j2
Normal file
12
roles/base/templates/etc/sudoers.j2
Normal file
@ -0,0 +1,12 @@
|
||||
# sudoers configuraton; per-host declarations go in /etc/sudoers.d
|
||||
# {{ ansible_managed }}
|
||||
|
||||
Defaults env_reset
|
||||
Defaults mail_badpass
|
||||
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
root ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
deploy ALL=(ALL:ALL) NOPASSWD: /bin/sh
|
||||
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
|
||||
#includedir /etc/sudoers.d
|
47
roles/base/templates/etc/sysctl.d/pvc.conf.j2
Normal file
47
roles/base/templates/etc/sysctl.d/pvc.conf.j2
Normal file
@ -0,0 +1,47 @@
|
||||
# General sysctl parameters for BLSE2
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Reduce swappiness
|
||||
vm.swappiness = 1
|
||||
|
||||
# enable Spoof protection (reverse-path filter)
|
||||
# Turn on Source Address Verification in all interfaces to
|
||||
# prevent some spoofing attacks
|
||||
net.ipv4.conf.default.rp_filter = 1
|
||||
net.ipv4.conf.all.rp_filter = 1
|
||||
|
||||
# Ignore ICMP broadcasts
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
|
||||
# Ignore bogus ICMP errors
|
||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
||||
|
||||
# Do not accept ICMP redirects (prevent MITM attacks)
|
||||
net.ipv4.conf.all.accept_redirects = 0
|
||||
{% if not 'rpi' in group_names %}
|
||||
net.ipv6.conf.all.accept_redirects = 0
|
||||
{% endif %}
|
||||
|
||||
# Do not send ICMP redirects (we are not a router)
|
||||
net.ipv4.conf.all.send_redirects = 0
|
||||
|
||||
# Do not accept IP source route packets (we are not a router)
|
||||
net.ipv4.conf.all.accept_source_route = 0
|
||||
{% if not 'rpi' in group_names %}
|
||||
net.ipv6.conf.all.accept_source_route = 0
|
||||
{% endif %}
|
||||
|
||||
# Don't log Martian Packets
|
||||
net.ipv4.conf.all.log_martians = 0
|
||||
|
||||
# Explicit Congestion Notification (ECN)
|
||||
net.ipv4.tcp_ecn = 1
|
||||
|
||||
# number of seconds the kernel waits before rebooting on a panic
|
||||
kernel.panic = 60
|
||||
|
||||
# Panic on an OOPS
|
||||
kernel.panic_on_oops = 1
|
||||
|
||||
# Restrict dmesg
|
||||
kernel.dmesg_restrict = 1
|
4
roles/base/templates/etc/systemd/journald.conf.j2
Normal file
4
roles/base/templates/etc/systemd/journald.conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# Journald configuration
|
||||
# {{ ansible_managed }}
|
||||
[Journal]
|
||||
Storage=persistent
|
10
roles/base/templates/etc/systemd/system/check_mk.socket
Normal file
10
roles/base/templates/etc/systemd/system/check_mk.socket
Normal file
@ -0,0 +1,10 @@
|
||||
# systemd socket definition file
|
||||
[Unit]
|
||||
Description=Check_MK Agent Socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=6556
|
||||
Accept=true
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
12
roles/base/templates/etc/systemd/system/check_mk@.service
Normal file
12
roles/base/templates/etc/systemd/system/check_mk@.service
Normal file
@ -0,0 +1,12 @@
|
||||
# systemd service definition file
|
||||
[Unit]
|
||||
Description=Check_MK
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/check_mk_agent
|
||||
KillMode=process
|
||||
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
StandardInput=socket
|
Reference in New Issue
Block a user