Git initial commit
This commit is contained in:
commit
368b8f1444
24 files changed
+789
No files matched your search
@@ -0,0 +1,5 @@
|
||||
[Definition]
|
||||
|
||||
failregex = ^<HOST> -.*GET .*/~.*
|
||||
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,5 @@
|
||||
[Definition]
|
||||
|
||||
failregex = ^<HOST> -.*GET http.*
|
||||
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,5 @@
|
||||
[Definition]
|
||||
|
||||
failregex = ^<HOST> -.*GET.*(\.asp|\.exe|\.pl|\.cgi|\.scgi)
|
||||
|
||||
ignoreregex =
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
[DEFAULT]
|
||||
bantime = {{ fail2ban_bantime }}
|
||||
findtime = {{ fail2ban_bantime }}
|
||||
maxretry = {{ fail2ban_maxretry }}
|
||||
|
||||
[sshd]
|
||||
enabled = true
|
||||
port = 22,{{ ssh_port }},ssh
|
||||
|
||||
[nginx-http-auth]
|
||||
enabled = {{ 'nginx' in fail2ban_activate_modules }}
|
||||
port = http,https
|
||||
filter = nginx-noscript
|
||||
logpath = %(nginx_error_log)s
|
||||
maxretry = 6
|
||||
|
||||
{% for filter in fail2ban_nginx_default_filter %}
|
||||
[{{ filter }}]
|
||||
enabled = {{ 'nginx' in fail2ban_activate_modules }}
|
||||
port = http,https
|
||||
filter = {{ filter }}
|
||||
logpath = %(nginx_access_log)s
|
||||
maxretry = 2
|
||||
|
||||
{% endfor %}
|
||||
{% for filter in fail2ban_nginx_selfmade_filter %}
|
||||
[{{ filter }}]
|
||||
enabled = {{ 'nginx' in fail2ban_activate_modules }}
|
||||
port = http,https
|
||||
filter = {{ filter }}
|
||||
logpath = %(nginx_access_log)s
|
||||
maxretry = 2
|
||||
|
||||
{% endfor %}
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
|
||||
|
||||
# This is the sshd server system-wide configuration file. See
|
||||
# sshd_config(5) for more information.
|
||||
|
||||
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
# The strategy used for options in the default sshd_config shipped with
|
||||
# OpenSSH is to specify options with their default value where
|
||||
# possible, but leave them commented. Uncommented options override the
|
||||
# default value.
|
||||
Protocol {{ ssh_protocol_version }}
|
||||
Port {{ ssh_port }}
|
||||
#AddressFamily any
|
||||
#ListenAddress 0.0.0.0
|
||||
#ListenAddress ::
|
||||
|
||||
#HostKey /etc/ssh/ssh_host_rsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||
#HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
|
||||
# Ciphers and keying
|
||||
#RekeyLimit default none
|
||||
|
||||
# Logging
|
||||
#SyslogFacility AUTH
|
||||
#LogLevel INFO
|
||||
|
||||
# Authentication:
|
||||
|
||||
#LoginGraceTime 10m
|
||||
PermitRootLogin {{ ssh_login_root }}
|
||||
#StrictModes yes
|
||||
#MaxAuthTries 6
|
||||
#MaxSessions 10
|
||||
|
||||
PubkeyAuthentication {{ ssh_use_key }}
|
||||
|
||||
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
|
||||
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
|
||||
|
||||
#AuthorizedPrincipalsFile none
|
||||
|
||||
#AuthorizedKeysCommand none
|
||||
#AuthorizedKeysCommandUser nobody
|
||||
|
||||
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
|
||||
#HostbasedAuthentication no
|
||||
# Change to yes if you don't trust ~/.ssh/known_hosts for
|
||||
# HostbasedAuthentication
|
||||
#IgnoreUserKnownHosts no
|
||||
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||
#IgnoreRhosts yes
|
||||
|
||||
# To disable tunneled clear text passwords, change to no here!
|
||||
PasswordAuthentication {{ ssh_use_password }}
|
||||
PermitEmptyPasswords no
|
||||
|
||||
# Change to yes to enable challenge-response passwords (beware issues with
|
||||
# some PAM modules and threads)
|
||||
ChallengeResponseAuthentication no
|
||||
|
||||
# Kerberos options
|
||||
#KerberosAuthentication no
|
||||
#KerberosOrLocalPasswd yes
|
||||
#KerberosTicketCleanup yes
|
||||
#KerberosGetAFSToken no
|
||||
|
||||
# GSSAPI options
|
||||
#GSSAPIAuthentication no
|
||||
#GSSAPICleanupCredentials yes
|
||||
#GSSAPIStrictAcceptorCheck yes
|
||||
#GSSAPIKeyExchange no
|
||||
|
||||
# Set this to 'yes' to enable PAM authentication, account processing,
|
||||
# and session processing. If this is enabled, PAM authentication will
|
||||
# be allowed through the ChallengeResponseAuthentication and
|
||||
# PasswordAuthentication. Depending on your PAM configuration,
|
||||
# PAM authentication via ChallengeResponseAuthentication may bypass
|
||||
# the setting of "PermitRootLogin without-password".
|
||||
# If you just want the PAM account and session checks to run without
|
||||
# PAM authentication, then enable this but set PasswordAuthentication
|
||||
# and ChallengeResponseAuthentication to 'no'.
|
||||
UsePAM yes
|
||||
|
||||
#AllowAgentForwarding yes
|
||||
#AllowTcpForwarding yes
|
||||
#GatewayPorts no
|
||||
X11Forwarding no
|
||||
#X11DisplayOffset 10
|
||||
#X11UseLocalhost yes
|
||||
#PermitTTY yes
|
||||
PrintMotd no
|
||||
#PrintLastLog yes
|
||||
#TCPKeepAlive yes
|
||||
#PermitUserEnvironment no
|
||||
#Compression delayed
|
||||
#ClientAliveInterval 0
|
||||
#ClientAliveCountMax 3
|
||||
#UseDNS no
|
||||
#PidFile /var/run/sshd.pid
|
||||
#MaxStartups 10:30:100
|
||||
#PermitTunnel no
|
||||
#ChrootDirectory none
|
||||
#VersionAddendum none
|
||||
|
||||
# no default banner path
|
||||
#Banner none
|
||||
|
||||
# Allow client to pass locale environment variables
|
||||
AcceptEnv LANG LC_*
|
||||
|
||||
# override default of no subsystems
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
|
||||
# Example of overriding settings on a per-user basis
|
||||
#Match User anoncvs
|
||||
# X11Forwarding no
|
||||
# AllowTcpForwarding no
|
||||
# PermitTTY no
|
||||
# ForceCommand cvs server
|
||||
@@ -0,0 +1 @@
|
||||
{% if not wireguard_is_gateway %}{{ wireguard_clients[wireguard_client_host].private_key }}{% else %}{{ wireguard_gateway_private_key }}{% endif %}
|
||||
@@ -0,0 +1 @@
|
||||
{% if not wireguard_is_gateway %}{{ wireguard_clients[wireguard_client_host].public_key }}{% else %}{{ wireguard_gateway_public_key }}{% endif %}
|
||||
@@ -0,0 +1,11 @@
|
||||
[Interface]
|
||||
Address = {{ wireguard_gateway_net_prefix }}.{{ wireguard_clients[wireguard_client_host].index }}/32
|
||||
PrivateKey = {{ wireguard_clients[wireguard_client_host].private_key }}
|
||||
DNS = {{ cloud_internal_dns }}
|
||||
|
||||
[Peer]
|
||||
PublicKey = {{ wireguard_gateway_public_key }}
|
||||
Endpoint = {{ wireguard_gateway_host }}:{{ wireguard_gateway_port }}
|
||||
AllowedIPs = {{ wireguard_gateway_net_prefix }}.1/{% if wireguard_allow_adjacent_client_traffic %}{{ wireguard_gateway_net_cidr }}{% else %}32{% endif %}
|
||||
|
||||
PersistentKeepalive = {{ wireguard_keepalive }}
|
||||
@@ -0,0 +1,25 @@
|
||||
[Interface]
|
||||
Address = {{ wireguard_gateway_net_prefix }}.1/{{ wireguard_gateway_net_cidr }}
|
||||
ListenPort = {{ wireguard_gateway_port }}
|
||||
PrivateKey = {{ wireguard_gateway_private_key }}
|
||||
|
||||
{% if wireguard_gateway_forward is defined and wireguard_gateway_forward | length > 0 %}
|
||||
PreUp = sysctl -w net.ipv4.ip_forward=1
|
||||
PreUp = sysctl -w net.ipv6.conf.all.forwarding=1
|
||||
|
||||
{% for config in wireguard_gateway_forward %}
|
||||
PreUp = iptables -t nat -A PREROUTING -i {{ wireguard_gateway_interface }} -p tcp --dport {{ config.server_port }} -j DNAT --to-destination {{ wireguard_gateway_net_prefix }}.{{ config.client_index }}:{{ config.client_port }}
|
||||
PostDown = iptables -t nat -D PREROUTING -i {{ wireguard_gateway_interface }} -p tcp --dport {{ config.server_port }} -j DNAT --to-destination {{ wireguard_gateway_net_prefix }}.{{ config.client_index }}:{{ config.client_port }}
|
||||
|
||||
{% endfor %}
|
||||
PreUp = iptables -t nat -A POSTROUTING -o {{ cloud_name }} -j MASQUERADE
|
||||
PostDown = iptables -t nat -D POSTROUTING -o {{ cloud_name }} -j MASQUERADE
|
||||
{% endif %}
|
||||
|
||||
{% for client in wireguard_clients %}
|
||||
## Wireguard {{ cloud_name }} - {{ client }} ##
|
||||
[Peer]
|
||||
PublicKey = {{ wireguard_clients[client].public_key }}
|
||||
AllowedIPs = {{ wireguard_gateway_net_prefix }}.{{ wireguard_clients[client].index }}/32
|
||||
|
||||
{% endfor %}
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
### VARIABLE ###################################################################
|
||||
environment_folder={{ cloud_env_path }}
|
||||
environment="{{ cloud_env }}"
|
||||
host_type="{{ cloud_host_group }}"
|
||||
script_name=$(basename $0)
|
||||
cloud_name="{{ cloud_name }}"
|
||||
cloud_type="{{ cloud_type }}"
|
||||
version="{{ cloud_control_version }}"
|
||||
branch_main="{{ cloud_git_branch_main }}"
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
### FUNCTION ###################################################################
|
||||
to_working_directory() {
|
||||
if [ ! -d $environment_folder/.git ] || [ ! -d $environment_folder ]; then
|
||||
echo "Environment '$environment' in '$environment_folder' not available or folder not a git repository! Abort."
|
||||
exit 1
|
||||
fi
|
||||
cd $environment_folder/$environment
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "$script_name, version $version by L.Hahn"
|
||||
echo ""
|
||||
echo " $cloud_name script for cloud control"
|
||||
echo " You can checkout environment (branches), rollout configurations,"
|
||||
echo " run ansible and restore entire configurations."
|
||||
echo ""
|
||||
echo "Usage: $script_name [command] [options]"
|
||||
echo ""
|
||||
echo "commands:"
|
||||
echo " - help print this help"
|
||||
echo " - maintenance setup local server into maintenance mode; no automatic ansible call"
|
||||
echo " - environment"
|
||||
echo " download <branch> checkout <branch> from remote repository"
|
||||
echo " update load latest remote changes for current branch"
|
||||
echo " reset stash changes and reset current branch from remote repository with latest changes"
|
||||
echo " restore checkout latest $branch_main branch from remote repository"
|
||||
echo " - update get latest roles according to environment requirements.yml"
|
||||
echo " - play play current loaded ansible playbooks"
|
||||
echo " - reset perform 1. environment restore, 2. update, 3. execute"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "example:"
|
||||
echo "~# $script_name environment update"
|
||||
echo " this will download changes from the currently active remote branch"
|
||||
}
|
||||
|
||||
environment() {
|
||||
to_working_directory
|
||||
current_branch=$(git branch | grep "^\*" | cut -d " " -f 2)
|
||||
current_upstream=$(git rev-parse $current_branch@{upstream})
|
||||
|
||||
env_option=$1
|
||||
case $env_option in
|
||||
"update")
|
||||
echo "### Updating branch '$current_branch' in $environment_folder ###"
|
||||
git pull
|
||||
;;
|
||||
"reset")
|
||||
echo "### Resetting branch '$current_branch' in $environment_folder ###"
|
||||
git reset --hard $current_branch
|
||||
git pull
|
||||
;;
|
||||
"restore")
|
||||
echo "### Restoring branch '$branch_main' in $environment_folder ###"
|
||||
git reset --hard HEAD
|
||||
git clean -f
|
||||
git checkout $branch_main
|
||||
git pull
|
||||
;;
|
||||
"download")
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Missing branch name for environment downloading"
|
||||
exit 1
|
||||
fi
|
||||
echo "### Stashing branch '$current_branch' & downloading branch '$2' in $environment_folder ###"
|
||||
git stash
|
||||
git checkout -b $2 origin/$2
|
||||
git pull
|
||||
;;
|
||||
*)
|
||||
echo "Unknown environments option '$env_option', abort!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
maintenance() {
|
||||
to_working_directory
|
||||
echo "maint"
|
||||
}
|
||||
|
||||
update() {
|
||||
to_working_directory
|
||||
ansible-galaxy install -f -p roles/ -r requirements.yml
|
||||
}
|
||||
|
||||
play() {
|
||||
to_working_directory
|
||||
ansible-playbook $cloud_type"-"$host_type".yml"
|
||||
}
|
||||
################################################################################
|
||||
|
||||
|
||||
### MAIN #######################################################################
|
||||
if [ $# -eq 0 ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
script_command=$1
|
||||
|
||||
case $script_command in
|
||||
"help")
|
||||
help
|
||||
;;
|
||||
"maintenance")
|
||||
maintenance
|
||||
;;
|
||||
"environment")
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "ERROR! environment command needs options! None provided."
|
||||
echo "Call '~# $script_name help' for more information."
|
||||
exit 1
|
||||
fi
|
||||
environment $2 $3
|
||||
;;
|
||||
"update")
|
||||
update
|
||||
;;
|
||||
"play")
|
||||
play
|
||||
;;
|
||||
"reset")
|
||||
echo "#=== restore environment ===#"
|
||||
environment restore
|
||||
echo ""
|
||||
echo "#=== update roles ===#"
|
||||
update
|
||||
echo ""
|
||||
echo "#=== play playbook ===#"
|
||||
play
|
||||
echo ""
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command '$script_command', abort!"
|
||||
echo "Call '~# $script_name help' for more information."
|
||||
;;
|
||||
esac
|
||||
################################################################################
|
||||
Reference in new issue
Block a user