Skip to content

Instantly share code, notes, and snippets.

@nlienard
nlienard / connect.sh
Created April 26, 2022 11:39 — forked from du-song/connect.sh
Cisco AnyConnect VPN Client on UBNT EdgeOS 2.0.9 via OpenConnect
openconnect -b -u USER SERVER
(.homeassistant) thoht@rpi3b-hass:~/.homeassistant$ hass --version
0.92.2
(.homeassistant) thoht@rpi3b-hass:~/.homeassistant$ sudo python3.6 -m pip install --upgrade homeassistant
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: homeassistant in /usr/local/lib/python3.6/site-packages (0.95.1)
Requirement already satisfied, skipping upgrade: cryptography==2.6.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.6.1)
Requirement already satisfied, skipping upgrade: requests==2.22.0 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.22.0)
Requirement already satisfied, skipping upgrade: astral==1.10.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (1.10.1)
Requirement already satisfied, skipping upgrade: voluptuous-serialize==2.1.0 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.1.0)
Requirement already satisfied, skipping upgrade: pip>=8.0.3 in /usr/local/lib/python3.6/site-packages (from
**********************
* SPL
**********************
root@atxscw-hy007:/usr/src/spl-0.6.5.9# dkms --verbose install spl/0.6.5.9
[...]
config.status: creating spl.release
config.status: creating spl_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
@nlienard
nlienard / gist:4f38d9a3846dbe56076ba3606df439e9
Created October 20, 2017 07:19
blocker via apache sur du x-forward-for
## Bad boys !!
<location />
SetEnvIfNoCase User-Agent "dts agent" GoAway=1
SetEnvIf X-Forwarded-For "^142\.44\.207\.70" GoAway=1
Order allow,deny
Allow from all
Deny from env=GoAway
</location>
ip link del link dev br_rlab
ip link del link dev vxlan_rlab
bridge vlan del vid 1034 dev eth3
bridge vlan del vid 1034 dev br_vrack self
bridge vlan del vid 1035 dev eth3
bridge vlan del vid 1035 dev br_vrack self
route del -net 224.0.0.0 netmask 240.0.0.0
route add -net 224.0.0.0 netmask 240.0.0.0 dev br_vrack
echo 1 > /sys/class/net/br_vrack/bridge/vlan_filtering
freebsd-update fetch
freebsd-update install
freebsd-update upgrade -r 11.0-RELEASE
freebsd-update install
reboot
freebsd-update install
pkg-static update -f
pkg-static install -f pkg
@nlienard
nlienard / archive-mails
Created November 26, 2016 10:36 — forked from pkern/archive-mails
A script for cleaning up mails in Maildir folders, with proper threading support
#!/bin/sh
BASE=$HOME/Maildir
ARCHIVEBASE=$HOME/Maildir/archive.
for folder in `find $BASE -maxdepth 1 -type d \! -regex '.*/archive\..*' \! -name cur \! -name tmp \! -name new`
do
folder=$(basename $folder)
if [ "${folder}" = "Maildir" ]; then folder=INBOX; fi
./cleanup-maildir.py --archive-folder=${ARCHIVEBASE}${folder} --maildir-root=$BASE --folder-prefix= --age=365 -d 1 -k -u -v archive ${folder}
2 SERVERS OVH
Server1 ETH1 10.0.1.1
Server2 ETH1 10.0.1.2
Server2 # mtr 10.0.1.1
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
To send the ip addres of the client/webbrowser to the server/webserver behind it there are a few options:
1- option forwardfor
2- send-proxy
3- source 0.0.0.0 usesrc clientip
1- option forwardfor
This is an easy option to configure in haproxy, it does require that http layer7 processing is used 'mode http' and the webserver/ webapplication that wants to log or use the ip of the client must use the http-header 'X-Forwarded-For' to read the clientip.
2- send-proxy / send-proxy-v2 / send-proxy-*
This is can be used both with mode tcp and http, it does however require that the server also understands the proxyprotocol. Some applications have added support for this protocol which adds a few bytes with ip information before the actual request.
service imap-login {
inet_listener imap {
#port = 143
}
inet_listener imaps {
port = 993
ssl = yes
}
# haproxy needs (cf http://wiki2.dovecot.org/HAProxy)