Skip to content

Instantly share code, notes, and snippets.

@bahattab
bahattab / .htaccess
Created October 2, 2021 14:21 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@bahattab
bahattab / Hosts File To Block Shock Sites
Last active June 3, 2022 10:38 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@bahattab
bahattab / mailserver.md
Created November 15, 2023 09:14 — forked from opentaq/mailserver.md
Mailserver Installation

Fail2Ban

sudo install fail2ban

UFW

sudo install ufw

UFW Settings

sudu ufw default deny incomoing

sudo ufw default allow outgoins

@bahattab
bahattab / cloudflare-ddns-update.sh
Created December 22, 2023 17:56 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record