Skip to content

Instantly share code, notes, and snippets.

View aduzsardi's full-sized avatar
🛠️
d(0_0)b

Alexandru Duzsardi aduzsardi

🛠️
d(0_0)b
View GitHub Profile
@aduzsardi
aduzsardi / interfaces
Last active January 6, 2023 01:46
GRE VPN Tunnel - Linux (Ubuntu)
# Configurare GRE tunel (VPN) on Ubuntu Linux
# There are two ubuntu servers acting as routers on their own LAN networks 172.18.17.0/24 , 172.18.18.0/24 respectively
# Each of the servers also have public IP address
# configure /etc/network/interfaces on the servers adding *gre1* interface
#Ubuntu1 - 192.168.168.1/30 is the local IP address on the gre1 interface , this IP will comunicate with the remote gre1 tunnel interface for routing
# - <post-up> command: 172.18.18.0/24 which is the remote LAN is routed through the tunnel to 192.168.168.2
auto gre1
iface gre1 inet tunnel
address 192.168.168.1
@aduzsardi
aduzsardi / backup.sh
Created April 5, 2017 12:41
FTP Backup Script bash
#!/bin/sh
# Script pentru backup remote prin ftp
# Dependente: mysql,mysqldump,gzip,curlftpfs
#
# Autor: Alex Duzsardi alex[dot]duzsardi[at]pitechplus[dot]com
# www.pitechplus.com
# ---------------------------------------------------------------------
### Variabile si configuratii ###
#!/bin/bash
# Configurare firewall ('man iptables') linux
# Cerinte: privilegii elevate (root)
# Setari: copiaza scriptul undeva accesibil doar de userul 'root' ,
# editeaza /etc/rc.local si inainte de 'exit 0' adauga calea absoluta spre script ex: /root/firewall.sh
# Contact: Alex Duzsardi <alex.duzsardi@pitechplus.com>
# www.pitechplus.com
#--------------------------------------------------------------
# Scriptul va rula cu debuging activat
@aduzsardi
aduzsardi / osx-install-media.md
Created July 24, 2017 11:39 — forked from cobyism/osx-install-media.md
Command to create installable OS X USB drive.

Creating a bootable macOS USB installer

  • First, plug in an 8GB (or bigger) USB drive, and use Disk Utility to erase it
  • If you use the default settings, you should wind up with a blank drive at /Volumes/Untitled.

With that volume in place, and with the macOS installer sitting in /Applications/Install\ macOS\ [VERSION].app, run the following command in your terminal to create a bootable install media (for Sierra):

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
@aduzsardi
aduzsardi / sshd_config
Created July 25, 2017 06:51
disable root login with password
#You can do this using the PermitRootLogin directive. From the sshd_config manpage:
#
# Specifies whether root can log in using ssh(1). The argument must be “yes”, “without-password”, “forced-commands-only”, or “no”. The default is “yes”.
#
# If this option is set to “without-password”, password authentication is disabled for root.
#
#The following will accomplish what you want:
# https://www.rationallyparanoid.com/articles/tcpdump.html
# DHCP debugging with tcpdump
# filter to match DHCP packets including a specific Client MAC Address:
tcpdump -i br0 -vvv -s 1500 '((port 67 or port 68) and (udp[38:4] = 0x3e0ccf08))'
# filter to capture packets sent by the client (DISCOVER, REQUEST, INFORM):
tcpdump -i br0 -vvv -s 1500 '((port 67 or port 68) and (udp[8:1] = 0x1))'
# Monitoring on interface eth0
@aduzsardi
aduzsardi / lb_vhost.conf
Created July 25, 2017 07:24
Load balancing apache config
<VirtualHost *:443>
LoadModule slotmem_shm_module /usr/lib/apache2/modules/mod_slotmem_shm.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so
ServerName dev.mydomain.com
<Proxy "balancer://mycluster">
BalancerMember "http://10.0.0.167:9090"
BalancerMember "http://10.0.0.168:9090"
@aduzsardi
aduzsardi / ssh-keygen-man
Created July 25, 2017 07:27
ssh-keygen command options and examples
SSH-KEYGEN
ssh-keygen
- generate ssh authentication keys
- default RSA key
- -t option for other types DSA,ECDSA,ED25519
- can generate DH (Diffie-Hellman group exchange DH-GEX)
- can generate and update Key Revocation Lists
OPTIONS
-A = create sshd keys (host keys)
@aduzsardi
aduzsardi / p7s_decrypt.sh
Created July 25, 2017 07:28
extract files from p7s attachments
#!/bin/bash
openssl pkcs7 -inform DER -in "$1" -print_certs -out "$1.pem"
openssl smime -verify -in "$1" -inform der -noverify -signer "$1.pem" -out "$1.pdf" 2>/dev/null
rm "$1.pem"
evince "$1.pdf"
rm "$1.pdf
@aduzsardi
aduzsardi / vim_commands
Created July 25, 2017 07:29
vim commands
VIM Commands
:vsp = vertical split
:sp = horizontal split
:quit - close current split
ctrl+w+w - change splited windows
:x - save and exit
:q - quit
:q! - quit without saving changes
:wq - write changes and quit