Skip to content

Instantly share code, notes, and snippets.

Avatar

AndersonIncorp

View GitHub Profile
@AndersonIncorp
AndersonIncorp / mikrotik-ovpn.md
Last active Mar 5, 2022
Short guide for setting up MikroTik ovpn server
View mikrotik-ovpn.md

CA cert

> System > Certificates
    > [Add new]
        Name: ca
        Country: UA
        Common name: ca
        Key size: 4096
 Key Usage: key cert. sign
@AndersonIncorp
AndersonIncorp / arch-openvpn-udp-tcp-server.md
Last active Mar 5, 2022
MIT License; Short guide for setting up openvpn-server service (tcp+udp), full network (redirect-gateway def1); Optional - Second VPS with traffic redirect to first via iptables; Optional - SSH tunneling for DPI prevention (pubkey)
View arch-openvpn-udp-tcp-server.md
$ pacman -S openvpn easy-rsa
$ cp -a /etc/easy-rsa/. /etc/easy-rsa-clientnet/
$ cd /etc/easy-rsa-clientnet/
$ export EASYRSA=$(pwd)
$ easyrsa init-pki
$ easyrsa build-ca nopass
$ easyrsa gen-req server nopass
$ easyrsa sign-req server server
@AndersonIncorp
AndersonIncorp / install.md
Created Jun 29, 2018
Install any linux distro on VPS with low RAM, locked ISO boot
View install.md

Overview

Scenario

  • Your VPS provider doesn't support ISO mount
  • Your VPS has low RAM and cannot load whole ISO image
  • Your current /boot is to small to contain ISO file

Workaround

  • Boot low memory ISO (CorePure64.iso ~ 14MB)
  • Create new partition ~1GB / size of your ISO
  • dd your ISO into that partition
@AndersonIncorp
AndersonIncorp / netboot.xyz.md
Created Jun 27, 2018
Install netboot.xyz.lkrn into grub
View netboot.xyz.md

Install netboot.xyz.lkrn into grub

wget https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn -O /boot/netboot.xyz.lkrn
nano /etc/grub.d/40_custom
#/etc/grub.d/40_custom
menuentry "netboot.xyz.lkrn" {
    linux16 (hd0,msdos1)/netboot.xyz.lkrn # /boot is (hd0,msdos1) drive
}
#
# One of
@AndersonIncorp
AndersonIncorp / build-php-zts7.2.1-archlinux.txt
Created Mar 25, 2018
build-php-zts7.2.1-archlinux.txt php-zts7.2.1 or php7.2.1 without conflict with main php
View build-php-zts7.2.1-archlinux.txt
# ! /bin/bash
# Build of php-zts OR php (if remove --enable-maintainer-zts flag) as second php into /usr/local/php/php-zts7.2.1
# Based on
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=php-zts
mkdir -p /root/aur-php/
cd /root/aur-php/
curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/php-zts.tar.gz
tar -xzf php-zts.tar.gz -C patch
curl -O -L https://php.net/distributions/php-7.2.1.tar.xz
@AndersonIncorp
AndersonIncorp / instal_bind.txt
Last active Nov 5, 2017
DNS Self hosted subzone *.ip.example.com.
View instal_bind.txt
### Install BIND
# https://wiki.archlinux.org/index.php/BIND
pacman -S bind
### Configure named.conf
# cp /etc/named.conf /etc/named.conf.bak
# nano /etc/named.conf
# diff /etc/named.conf.bak /etc/named.conf
9c9
< // listen-on-v6 { any; };
---
@AndersonIncorp
AndersonIncorp / postfix.md
Last active Jan 24, 2022
postfix && dovecot virtual email setup (redirect to gmail+alias from domain)
View postfix.md

postfix && dovecot virtual email setup (redirect to gmail+alias from domain)

Example shows 2 domains in 1 IP address && 1 postfix instance. All redirected to Gmail.
First domain used as myhostname and is main domain. Others is virtual_alias_domains
Dovecot configured to use passwd database without IMAP && POP3. SMTP auth only
Gmail configured to send emails from our domains (using smtp TLS port 25).
DNS && SPF && PTR records. Example provided.

Brief config overview
Domains /etc/postfix/main.cf
@AndersonIncorp
AndersonIncorp / fix.sh
Created May 23, 2017
GRUB loading. Welcome to GRUB! error: file `/boot/grub/i386-pc/normal.mod` not found.
View fix.sh
# GRUB loading.
# Welcome to GRUB!
#
# error: file `/boot/grub/i386-pc/normal.mod` not found.
# Entering rescue mode...
grub rescue> ls
hd(0) (hd0,msdos1)
grub rescue> set
cmdpath=(hd0)
prefix=(hd0,msdos1)/boot/grub
@AndersonIncorp
AndersonIncorp / .bash_login
Last active Jul 10, 2018
Present info on terminal/ssh login. ~/.bash_login file
View .bash_login
#!/bin/bash
## SSH Check
if [ -n "$SSH_CONNECTION" ] && [ "$SHLVL" == "1" ]; then
## pacman -S pacman-contrib
## https://unix.stackexchange.com/questions/119126
stat_mem=$(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }')
stat_disk=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}')
stat_cpu=$(top -bn1 | grep load | awk '{printf "%.2f\n", $(NF-2)}')
echo -e -n " Date : `date +"%A, %e %B %Y, %r"`
Hostname : `hostname`
@AndersonIncorp
AndersonIncorp / install.sh
Last active Nov 30, 2021
OS X to Linux gcc cross compiler build (arch linux x86_64 as target)
View install.sh
#!/bin/bash
set -e
# Prerequirements
# brew install gcc (gmp libmpc mpfr isl)
# copy /usr/lib && /usr/include from arch linux into your CC_ROOT.
# /usr/local/linux/usr/include
# /usr/local/linux/usr/lib
# /usr/local/linux/usr/local/include
# arch linux is target enviroment for this cross compiler
# x86_64 binutils && gcc