Skip to content

Instantly share code, notes, and snippets.

@selankon
selankon / wg-nat-routing.sh
Created February 27, 2024 13:40
Wireguard enable Nat script
#!/bin/bash
# Define paths to iptables and ip6tables
IPT="/sbin/iptables"
IPT6="/sbin/ip6tables"
# Define network interfaces and network configurations
IN_FACE="eth0" # NIC connected to the internet
WG_FACE="wg0" # WG NIC
SUB_NET="10.5.0.0/24" # WG IPv4 sub/net aka CIDR
@selankon
selankon / prepare_local_repository.sh
Last active May 5, 2024 14:20
Lime packages utils
#!/bin/bash
# Description
# This scripts modify the mastertest.lua file to use the IP address of the interface provided as an argument
# It also creates a json file with the latest firmware information with the IP address of the interface provided as an argument
# Board name of the json file
BOARD_NAME="librerouter-librerouter-v1"
#BOARD_NAME="hilink-hlk-7621a-evb"
# IMG SUM write on the JSON file
@selankon
selankon / update_packs.sh
Last active March 15, 2024 07:16
Libremesh packagesupdater
#!/bin/bash
# THIS SCRIPT IS FOR DEVELOPMENT USSAGE ONLY
# Do not use it on production
# It creates a temporal unprotected ssh key and add it as unique key on the
# /etc/dropbear/authorized_keys on destination ip, which is not safe.
# It copy to an ip a specific package on a libremesh node.
# Run it from lime packages folder
# Example:
# ./update_packs.sh 10.13.0.1 ubus-lime-metrics
@selankon
selankon / SshVpn.sh
Created May 3, 2018 19:03
Like VPN using ssh. Script that creates an ssh tunel associated to a "tun" interface to use it as default interface.
#!/bin/bash
# Like VPN using ssh. Script that creates an ssh tunel associated to a "tun" interface to use it as default interface. See man ssh option -w for more info.
# 1. Establish ssh tunel
# 2. Creates and associate it to the tun interface
# 3. Redirect al system trafic to this interface
#
# Like tipical VPN connections, all your traffic is tunneled by this p2p connection
# IMPORTANT:
# On the client in /etc/ssh/ssh_config set Tunnel point-to-point
# On the sercer in /etc/ssh/sshd_config set PermitTunnel point-to-point
@selankon
selankon / SshVpn.sh
Last active June 4, 2018 11:42
Like VPN using ssh. Script that creates an ssh tunel associated to a "tun" interface to use it as default interface.
#!/bin/bash
# Like VPN using ssh. Script that creates an ssh tunel associated to a "tun" interface to use it as default interface. See man ssh option -w for more info.
# 1. Establish ssh tunel
# 2. Creates and associate it to the tun interface
# 3. Redirect al system trafic to this interface
#
# Like tipical VPN connections, all your traffic is tunneled by this p2p connection
# IMPORTANT:
# On the client in /etc/ssh/ssh_config set Tunnel point-to-point
# On the sercer in /etc/ssh/sshd_config set PermitTunnel point-to-point
@selankon
selankon / createTinc.sh
Last active March 2, 2022 09:27
Create all necessary files for a tinc host or server with an option to redirect all traffic to tinc interface
#/bin/bash
# Script to manage easy the creation and configuration of a tinc client
# Net and host names
NETNAME=lanparty
HOSTNAME=mylaptop
# Server settings
SERVERNAME=server # Let this string empty if you are creating the server (with a public ip address)
PUBLICADDRESS=ageof.lol
@selankon
selankon / createOvpn.sh
Created May 4, 2016 10:36
Create OVPN client and configuration file
#!/bin/bash
# This script create a client and his .ovpn file
# Works on easy-rsa v3.0.0, in the easy-rsa root folder.
# 1- Create certificate protected or not for password
# 2- Sign it
# 3- Encrypt or not the certificate using 3des
# 4- Creates the ovpn file
# Default Variable Declarations
@selankon
selankon / convert.sh
Created May 4, 2016 10:32
Convert multiple jpg to single pdf
#This script converts an amount of files of any type to a single pdf file.
#The files must be named:
# <NAME_OF_FILE><NUMBER>.<TYPE>
#This loop go over all the files converting its to .pdf in the /pdf folder using convert
#After merge all using pdfunite
#See convert man for more help about how to convert to pdf
START=1 #Start Number
END=38 #Final Number
NAME="firstaid" #File Name