Skip to content

Instantly share code, notes, and snippets.

@Madji
Madji / ssh-telegram.sh
Created January 22, 2017 14:53 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@Madji
Madji / client.sh
Created May 6, 2017 14:13 — forked from mwoodbri/client.sh
tinc
ADDRESS=10.10.0.2
CLIENT=$(hostname -s)
yum install -y epel-release
yum install -y tinc
mkdir -p /etc/tinc/hosts
cat >/etc/tinc/tinc.conf <<EOF
Name=$CLIENT
ConnectTo=vp1
EOF
tincd -K </dev/null
@Madji
Madji / bridge-conf
Created August 20, 2017 12:45 — forked from Belphemur/bridge-conf
Configuration and scripts for OpenVPN in Bridged Mode. Script to generate new client (with their keys and configuration file for OpenVPN). Script to manage the bridge. Configuration for systemd to start/stop the OpenVPN with Brige.
#!/bin/bash
# Define physical ethernet interface to be bridged
# with TAP interface(s) above.
eth="eth0"
eth_ip="192.168.42.2"
eth_netmask="255.255.255.0"
eth_broadcast="192.168.42.255"
eth_gateway="192.168.42.1"
eth_mac="XX:XX:XX:XX:XX:XX"
@Madji
Madji / vpnclient
Created January 21, 2018 08:30 — forked from legokichi/vpnclient
softether vpn client for ubuntu /etc/init.d/vpnclient
#! /bin/sh
### BEGIN INIT INFO
# Provides: vpnclient
# Required-Start: $all
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VPN Client at boot time
# chkconfig: 345 44 56
# description: Start VPN Client at boot time.
@Madji
Madji / README.md
Created May 5, 2018 10:40 — forked from LeonDevLifeLog/README.md
Telegram webhooks with nginx reverse proxy

Make config file:

sudo nano /etc/nginx/sites-available/bot.conf

Then copy and paste bot.conf content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports and easily install it with apt-get:

sudo apt-get install -t jessie-backports letsencrypt

Then get cert for you domain:

@Madji
Madji / he-dns-update.sh
Created November 24, 2018 17:15 — forked from joemiller/he-dns-update.sh
script for updating dynamic DNS records on he.net (hurricane electric)
#!/bin/bash
#
# Script for updating DNS records on Hurricane Electirc's DNS system (https://dns.he.net).
#
# The record will be updated with the IP address that originates the request.
#
# Usage
# -----
#
# Create config file `/etc/he-dns-update.conf`:
@Madji
Madji / haproxy.cfg
Created September 4, 2019 06:07 — forked from T0MM0R/haproxy.cfg
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@Madji
Madji / yubikey.md
Created June 9, 2021 12:19 — forked from askd/yubikey.md
Привет, yubikey

Итак, вы стали счастливым обладателем yubikey. С чего начать?

Если в вашем ноутбуке только один USB-порт, рекомендую заказать USB-хаб. Впрочем, ключ не обязательно должен всё время занимать порт, так что если вы не используете бэкап-диск или что-то ещё, претендующее на порт, то можно начать без хаба.

Если ваш основной браузер Safari, то... :sad_trombone: Придётся что-то менять в жизни. Попробуйте Chrome, он хороший. (Я не проверяла, работает ли ключ в Firefox, у вас есть возможность поделиться опытом)

Итак, предварительная подготовка окончена, приступим к самому интересному.