Rename auxiliary ffhh roles
This commit is contained in:
parent
7e739c8c70
commit
a32926b0b9
7 changed files with 2 additions and 2 deletions
|
|
@ -2,13 +2,13 @@
|
||||||
- hosts: ffhh
|
- hosts: ffhh
|
||||||
roles:
|
roles:
|
||||||
- basics
|
- basics
|
||||||
- ffhh-basics
|
- basics-ffhh
|
||||||
tags: basics
|
tags: basics
|
||||||
|
|
||||||
- hosts: nginx
|
- hosts: nginx
|
||||||
roles:
|
roles:
|
||||||
- nginx
|
- nginx
|
||||||
- nginx-extra
|
- nginx-ffhh
|
||||||
- error-pages
|
- error-pages
|
||||||
tags: nginx
|
tags: nginx
|
||||||
|
|
||||||
|
|
|
||||||
68
roles/basics-ffhh/files/new-user
Executable file
68
roles/basics-ffhh/files/new-user
Executable file
|
|
@ -0,0 +1,68 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script assumes that you want to add a user with name
|
||||||
|
# equal to a keyfile in the freiunkhamburg/ssh-keys repo
|
||||||
|
# on github.
|
||||||
|
#
|
||||||
|
# This script assumes you know what you are doing. ;)
|
||||||
|
#
|
||||||
|
# .. ohrensessel, 2017
|
||||||
|
#
|
||||||
|
|
||||||
|
echoerr() { echo "$@" 1>&2; }
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echoerr Missing username
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echoerr This script must be run as root
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if id "$1" >/dev/null 2>&1; then
|
||||||
|
echoerr This user exists
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -P /tmp https://raw.githubusercontent.com/freifunkhamburg/ssh-keys/master/"$1".pub &>/dev/null
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
echoerr Could not download key file, username not equal to name of key file?
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Adding user with name "$1" and ssh keys:
|
||||||
|
echo
|
||||||
|
cat /tmp/"$1".pub
|
||||||
|
echo
|
||||||
|
|
||||||
|
read -p "Are you sure? " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
echoerr Aborting...
|
||||||
|
rm /tmp/"$1".pub
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
useradd -m -G sudo "$1"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
echoerr Could not add user
|
||||||
|
rm /tmp/"$1".pub
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$1":test123 | chpasswd &>/dev/null
|
||||||
|
chage -d0 "$1" &>/dev/null
|
||||||
|
|
||||||
|
mkdir /home/"$1"/.ssh
|
||||||
|
mv /tmp/"$1".pub /home/"$1"/.ssh/authorized_keys
|
||||||
|
chown "$1":"$1" /home/"$1"/.ssh -R
|
||||||
|
chmod 700 /home/"$1"/.ssh
|
||||||
|
chmod 600 /home/"$1"/.ssh/authorized_keys
|
||||||
17
roles/basics-ffhh/tasks/main.yml
Normal file
17
roles/basics-ffhh/tasks/main.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- name: install popular user packages
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- mosh
|
||||||
|
- nano
|
||||||
|
- wget
|
||||||
|
- zsh
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: copy new-user script
|
||||||
|
copy:
|
||||||
|
src: new-user
|
||||||
|
dest: /usr/local/sbin
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0550
|
||||||
3
roles/nginx-ffhh/files/snippets/autoindex.conf
Normal file
3
roles/nginx-ffhh/files/snippets/autoindex.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
autoindex on;
|
||||||
|
autoindex_exact_size on;
|
||||||
|
autoindex_localtime off;
|
||||||
6
roles/nginx-ffhh/files/snippets/location-acme-srv01.conf
Normal file
6
roles/nginx-ffhh/files/snippets/location-acme-srv01.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
location ^~ /.well-known/acme-challenge {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_pass http://srv01.hamburg.freifunk.net$request_uri;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
8
roles/nginx-ffhh/files/snippets/no-unsafe-files.conf
Normal file
8
roles/nginx-ffhh/files/snippets/no-unsafe-files.conf
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
disable_symlinks if_not_owner from=$document_root;
|
||||||
|
|
||||||
|
# Do not serve dotfiles.
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
5
roles/nginx-ffhh/tasks/main.yml
Normal file
5
roles/nginx-ffhh/tasks/main.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: copy snippets
|
||||||
|
copy:
|
||||||
|
src: snippets/
|
||||||
|
dest: /etc/nginx/snippets/
|
||||||
Loading…
Reference in a new issue