Skip to content

Instantly share code, notes, and snippets.

@patrocle
patrocle / iptables.md
Last active March 2, 2017 15:33
Iptables web server boot script

STEP 1

sudo vim /etc/init.d/firewall

STEP 2

### BEGIN INIT INFO
# Provides:          firewall rules
# Required-Start:    $remote_fs $syslog
@patrocle
patrocle / Chroot SFTP user with www-data rights.md
Last active October 10, 2024 16:37
SFTP MYUSER will have all rights to create files/folders with www-data as owner and group in /var/www

Debian tips to chroot a user in it's home and add rights for www-data

STEP 1

sudo apt-get -y install bindfs

STEP 2

sudo mkdir -p /home/MYUSER/www
sudo chown -Rf MYUSER:MYUSER /home/MYUSER/www  
@patrocle
patrocle / Nginx + Apache reverse proxy REAL IP.md
Last active July 23, 2024 17:39
Real IP for Apache (Nginx reverse proxy)

NGINX 1.10 + APACHE 2.4 real IP for reverse proxy

Edit nginx conf

default.conf or what you want

vim /etc/nginx/conf.d/default.conf

add proxy_set_header for php files

@patrocle
patrocle / UserNewPasswordCommand.php
Last active January 14, 2021 09:23
Laravel 8 - send email to user with reset password link
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Password;
class UserNewPasswordCommand extends Command
{
@patrocle
patrocle / block-tor-exit-nodes-iptables.md
Created February 28, 2022 11:42 — forked from jkullick/block-tor-exit-nodes-iptables.md
Block Tor Exit Nodes with IPTables
  1. Install ipset:
apt-get install ipset
  1. Create new ipset:
ipset create tor iphash