Skip to content

Instantly share code, notes, and snippets.

@positiveque
positiveque / block-tor-geoip-nginx.sh
Created August 29, 2020 10:07
How To Block Tor Exit-Nodes with Nginx (GeoIP)
#!/bin/sh
# Download a list of exit-nodes
wget -qO- https://check.torproject.org/torbulkexitlist | sort | awk '{print "" $1 " 1;"}' > /tmp/tor_exit_list.txt
# Prepare a geoip config
echo -e "geo \$isTor {\ndefault 0; \n$(cat /tmp/tor_exit_list.txt) \n}" > /etc/nginx/conf.d/deny-geoip-tor.conf
## Add to virtual host
# location / {
# if ($isTor) {
# return 403;
!.gitignore
!.htaccess
!.htpasswd
%20../
%2e%2e//google.com
%2e%2e;/test
%3f/
%C0%AE%C0%AE%C0%AF
%EXT%
%ext%.bak
# setup
# export ANSIBLE_HOSTS=~/.ansible/hosts
# https://gist.github.com/runeleaf/5721014
- hosts: develop
user: kawashima
sudo: yes
tasks:
- include: centos/system-setup.yml
- include: centos/install-common-item.yml
- include: centos/install-add-item.yml
@positiveque
positiveque / ansible commands
Created August 28, 2020 10:13 — forked from pareddy113/ansible commands
Ansible commands
-i :inventory file
-u list_of_server :username for remote login for the list_of_servers
-m :runs the moudle name and gives the output
-a :shell arguments to run on the remote machine ex: ls, docker ps, etc
-f : specify the number of parallel process to run\
-B : run asynchronously, failing after X
Modules:
---
###############################################################################
#
# GLOBAL Config: ansible/inventory/group_vars/all/pki.yml
#
###############################################################################
# Enable staging env during development
#pki_acme_ca: 'le-staging-v2'
@positiveque
positiveque / sources.list
Created August 28, 2020 08:44
Ubuntu 20.04 LTS (Focal Fossa) - LEMP stack (nginx mainline, php, mariadb 10.5) - /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@positiveque
positiveque / ssh-proxy.sh
Created July 30, 2020 15:42 — forked from pi0/ssh-proxy.sh
SSH-SSH
ssh -vo ProxyCommand='ssh -W %h:%p root@proxy_host' root@dst_host
@positiveque
positiveque / pagespeed_nginx_ubuntu.sh
Created July 30, 2020 15:41 — forked from pi0/pagespeed_nginx_ubuntu.sh
Install PageSpeed on Ubuntu Nginx Extras
# Deps
sed -i "s|# deb-src|deb-src|" /etc/apt/sources.list
apt update
export DEPS=" \
build-essential zlib1g-dev libpcre3-dev unzip uuid-dev \
debhelper po-debconf libexpat-dev libgd-dev libgeoip-dev libhiredis-dev \
libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev libssl-dev libxslt1-dev quilt"
apt install -y $DEPS
# NXG Pagespeed
@positiveque
positiveque / compile_nginx_from_sources.yml
Last active August 28, 2020 10:34 — forked from dkorn/compile_nginx_from_sources.yml
Ansible Playbook compiling NGINX from sources, to include particular modules
---
- name: Compile NGINX from sources
hosts: webserver
vars:
nginx_version: nginx-1.13.4
nginx_tarball_url: "http://nginx.org/download/{{ nginx_version }}.tar.gz"
nginx_install_dir: "/tmp/{{ nginx_version }}"
nginx_sbin_path: "/usr/sbin/nginx"
nginx_conf_path: "/etc/nginx/nginx.conf"