Skip to content

Instantly share code, notes, and snippets.

View andrewnimmo's full-sized avatar

Andrew David Nimmo andrewnimmo

View GitHub Profile
#!/bin/bash
# "Register JDK7 for update-alternatives Script in Debian Way"
# Based on 1. codeslinger's "install_java7_alternatives" from https://gist.github.com/445930
# 2. sun-java6-plugin.deb postint script (for plugin)
# Modified by Cheng-Wei Chien<e.cwchien@gmail.com>, 2012-08-16
# ------------------------------------------------------------------------------
# Note: This script works on x86/amd64 Debian GNU/Linux|Ubuntu.
# If you use other arch or distro, you may have to modify some parameters.
#
# Usage: 1. Extract jdk7 tar.gz to, for example, /usr/lib/jvm/java-7-sun-1.7.0.13,
@andrewnimmo
andrewnimmo / openvpn-in-lxd.txt
Created April 10, 2018 07:19 — forked from wastrachan/openvpn-in-lxd.txt
OpenVPN in LXD Container
# On the host
=============
lxc config set openvpn raw.lxc 'lxc.cgroup.devices.allow = c 10:200 rwm'
lxc config device add openvpn tun unix-char path=/dev/net/tun
# In the container
==================
1. mknod /dev/net/tun c 10 200
acl_check_dkim:
# Skip this whole acl if header.d contains an @ sign because exim is
# breaking down the header.i part (which usually is an email address)
# bit by bit, working towards just the domain name.
accept condition = ${if match{$dkim_cur_signer}{\N@\N}}
accept dkim_status = none
sender_domains = KNOWN_DKIM_SIGNERS
dkim_signers = KNOWN_DKIM_SIGNERS
condition = ${if eqi{$sender_address_domain}{$dkim_cur_signer} {yes}{no}}
@andrewnimmo
andrewnimmo / dovecot-archive.sh
Created December 16, 2018 17:37 — forked from Disassembler0/dovecot-archive.sh
dovecot-archive.sh
#!/bin/bash
USER="box@example.com"
RETENTION=120
ARCHIVE_ROOT="Archiv"
BOXES_TO_ARCHIVE=("INBOX" "Odeslaná pošta")
# Load all existing subfolders in BOXES_TO_ARCHIVE
BOXES=()
@andrewnimmo
andrewnimmo / rspamd-whitelisting.md
Created February 12, 2019 22:15 — forked from ThomasLeister/rspamd-whitelisting.md
How to whitelist IP addresses or domains in Rspamd

Whitelist IP addresses based on pre-filter policy

/etc/rspamd/local.d/multimap.conf:

  IP_WHITELIST {
      type = "ip";
      prefilter = "true";
      map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
 action = "accept";
@andrewnimmo
andrewnimmo / rspamd-lists.md
Created February 12, 2019 22:16 — forked from kvaps/rspamd-lists.md
Howto create local whitelists and blacklists for Rspamd

Local whitelists and blacklists for Rspamd

  • cd /etc/rspamd
  • create rspamd.conf.local
  • create lists:
touch local_bl_from.map.inc local_bl_ip.map.inc local_bl_rcpt.map.inc \
local_wl_from.map.inc local_wl_ip.map.inc local_wl_rcpt.map.inc
  • change permissions:
@andrewnimmo
andrewnimmo / default.vcl
Created April 13, 2019 20:20 — forked from joseluisq/default.vcl
Varnish Cache v3 configuration for subdomains
# Customizing Varnish Cache for subdomains
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
# If exists any trouble, disable the cookie
if (!req.backend.healthy) {

Keybase proof

I hereby claim:

  • I am andrewnimmo on github.
  • I am andrewnimmo (https://keybase.io/andrewnimmo) on keybase.
  • I have a public key ASCYRnblxKsMXl_10I8T7iwQSGVqhQljaM83W03Gsyr5wwo

To claim this, I am signing this object:

@andrewnimmo
andrewnimmo / instructions.md
Created April 16, 2019 12:45 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret &gt; keybase-private.key
@andrewnimmo
andrewnimmo / create_debian-sys-maint_for_mysqladmin.sh
Created April 22, 2019 10:37 — forked from waja/create_debian-sys-maint_for_mysqladmin.sh
Create 'debian-sys-maint' MariaDB user for use of mysqladmin. Just in case you can't use 'root' via 'unix_socket' plugin.
#!/bin/sh
MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf"
# generate password
PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)');
# adjust /etc/mysql/debian.cnf (used as defaults file by system scripts)
sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf
sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf
# create config file for mysqladmin itself (maybe not needed)
umask 066
cat > ${MYSQLADMIN_CFG} <<EOF