Skip to content

Instantly share code, notes, and snippets.

View aalmenar's full-sized avatar
🏚️

Adrian aalmenar

🏚️
View GitHub Profile
@aalmenar
aalmenar / rspamd-learn-ham.sh
Created November 19, 2019 19:48 — forked from skroczek/rspamd-learn-ham.sh
rspamd learn spam and ham from imap-server using curl. Randomize rspamd frontends with fallback.
#!/bin/bash
function log_error() { echo `date '+%Y-%m-%d %H:%M:%S'` ERROR: $1 >&2; }
function log() { echo `date '+%Y-%m-%d %H:%M:%S'` INFO: $1; }
MAIL=$(tee)
SERVER_LIST="['10.10.115.15', '10.10.115.16']"
PASSWORD="p455w0rD"
@aalmenar
aalmenar / ripeval.service
Created June 11, 2019 21:19 — forked from carlosm3011/ripeval.service
RIPE-NCC RPKI Validator - systemd unit file
# cat /etc/systemd/system/ripeval.service
[Unit]
Description=RIPE-NCC RPKI Validator
After=network.target
[Service]
Type=forking
User=ripeval
WorkingDirectory=/home/ripeval
ExecStart=/home/ripeval/ripeval_latest/rpki-validator.sh start
@aalmenar
aalmenar / wireguard_config.txt
Created May 31, 2019 13:45 — forked from diyism/wireguard_config.txt
wireguard config
$ sudo apt-get install linux-headers-$(uname -r)
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
$ sudo modprobe wireguard
$ sudo mkdir /etc/wireguard
$ (umask 077 && printf "[Interface]\nPrivateKey = " | sudo tee /etc/wireguard/wg0.conf > /dev/null)
$ wg genkey | sudo tee -a /etc/wireguard/wg0.conf | wg pubkey | sudo tee /etc/wireguard/publickey
$ sudo nano /etc/wireguard/wg0.conf
@aalmenar
aalmenar / workaround.md
Created May 22, 2019 16:44 — forked from cheeseplus/workaround.md
Chef Infra License Errors in Test-kitchen and Packer

If you're getting errors like:

       +---------------------------------------------+
            Chef License Acceptance
       
       Before you can continue, 2 product licenses
       must be accepted. View the license at
       https://www.chef.io/end-user-license-agreement/
       
@aalmenar
aalmenar / set-ovpn-firewall.sh
Created November 28, 2018 15:05 — forked from f1r-CTLF/set-ovpn-firewall.sh
Basic, hardened iptables + ip6tables firewall script for an OpenVPN 2.3.x server running dnscrypt-proxy and unbound for DNS. Designed with security testing in mind. Supports dual-stack IPv4 + IPv6. Hardens against many common attacks, and implements strict filtering of DHCP, ICMPv6, and DHCPv6. Tested on Arch Linux; most Linux should work, also.
#!/bin/bash
echo ' (pre) script declarations'
IP6TABLES='/sbin/ip6tables'
IP4TABLES='/sbin/iptables'
LAN_IF='ens+'
TUN_IF='tun+'
INNER_GLOBAL_UNICAST='2001:0db8:ffff:ffff::/48'
INNER_IPV4_UNICAST='10.8.0.0/24'
IPV4_LINK_LOCAL='169.254.0.0/16' #RFC 3927
IPV6_LINK_LOCAL='fe80::/10' #RFC 4291
@aalmenar
aalmenar / tcpdump IPv6 router advertisement
Created March 15, 2018 15:51 — forked from hgn/tcpdump IPv6 router advertisement
Capture of IPv6 advertisement message via tcpdump
@virgo:~ $ sudo tcpdump -vvvv -ttt -i eth1 icmp6 and 'ip6[40] = 134'
00:00:00.000000 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 200) fe80::b675:eff:fefa:1cb > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 200
hop limit 0, Flags [managed, other stateful], pref medium, router lifetime 1800s, reachable time 0s, retrans time 0s
source link-address option (1), length 8 (1): b4:75:0e:fa:01:cb
0x0000: b475 0efa 01cb
mtu option (5), length 8 (1): 1280
0x0000: 0000 0000 0500
prefix info option (3), length 32 (4): 2a01:ffff:43f::/64, Flags [onlink, auto], valid time 7200s, pref. time 1800s
0x0000: 40c0 0000 1c20 0000 0708 0000 0000 2a01
0x0010: ffff 043f 0000 0000 0000 0000 0000
@aalmenar
aalmenar / ecdsa_example.rb
Created January 29, 2018 16:14 — forked from ostinelli/ecdsa_example.rb
ECDSA usage from Ruby.
require 'openssl'
require 'base64'
# ===== \/ sign =====
# generate keys
key = OpenSSL::PKey::EC.new("secp256k1")
key.generate_key
public_key = key.public_key
public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format
@aalmenar
aalmenar / synology-pushover.php
Created October 2, 2017 15:10 — forked from styxit/synology-pushover.php
A php script that can be used on a Synology Nas to revive Pushover notifications. https://styxit.com/2014/05/10/synology-pushover.html
<?php
/************************************/
/********** CONFING START ***********/
// Only allow request made by localhost?
// Set this to false if this script is not running on your synology webserver (less secure)
$localOnly = true;
/********** CONFING END *************/
/************************************/
@aalmenar
aalmenar / .htaccess
Created September 25, 2017 10:57 — forked from bhollis/.htaccess
Serving pre-gzipped assets from Apache
AddEncoding gzip .gz
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Konqueror
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.css$ $1.css.gz [QSA,L]
RewriteRule ^(.*)\.js$ $1.js.gz [QSA,L]
RewriteRule ^(.*)\.html$ $1.html.gz [QSA,L]
@aalmenar
aalmenar / gist:a690f2b36f1bf995ebf826f04b1ec854
Created September 20, 2017 12:12 — forked from qsun/gist:1247402
ruby integer to/from ip address
require 'ipaddr'
IPAddr.new('1.2.3.4').to_i
IPAddr.new(16909060, Socket::AF_INET).to_s