Skip to content

Instantly share code, notes, and snippets.

@i-blis
i-blis / README.md
Created January 18, 2025 23:59 — forked from flaviovs/README.md
How to use TARPIT in Linux without consuming (your) resources

Iptables(8) TARPIT is a useful security mechanism that can slow down or stop attacks on a network. If everyone used TARPIT to block attackers, in theory their resources would be exhausted as their connection attempts would be delayed, which would discouraged people from attempting unauthorized access. Here's a brief description of how TARPIT works:

To achieve this tar pit state, iptables accepts the incoming TCP/IP connection and then switches to a zero-byte window. This forces the attacker's system to stop sending data, rather like the effect of pressing Ctrl-S on a terminal. Any attempts by the attacker to close the connection are ignored, so the connection remains active and typically times out after only 12–24 minutes. This consumes resources on the attacker's system but not

@i-blis
i-blis / genpass.clj
Created August 10, 2021 01:16
Simple Password Generator
#!/usr/bin/env bb
(require '[clojure.tools.cli :refer [parse-opts]])
(def generator (java.security.SecureRandom.))
(defn gen-pass [alphabet length]
(let [bound (count alphabet)
idxs (repeatedly length #(.nextInt generator bound))]
(apply str (map alphabet idxs))))
@i-blis
i-blis / recipe.txt
Created March 2, 2015 15:18
Change hostname
Edit `/etc/hostname` and then run `/etc/init.d/hostname.sh start`
@i-blis
i-blis / recipe.md
Created March 2, 2015 15:15
Change time zone on server

Debian

Simply run dpkg-reconfigure tzdata and select the timezone.

FreeBSD

We need to copy or link the timezone file to /etc/localtime:

cp /usr/share/zoneinfo/Pacific/Noumea /etc/localtime
@i-blis
i-blis / better-recipe.md
Last active August 29, 2015 14:01
Install Oracle Java on Debian

Install Oracle Java on Debian

Download

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz

Install

mkdir /opt/jdk

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

@i-blis
i-blis / recipe.md
Created May 25, 2014 19:53
Best practices for ssh access to remote (production) server

Disallowing root access with password authentication

On machines with a single sysadmin where the root account is enabled, it might still be convenient to allow root login through key pairing only by disabling remote password login for root. To this end, /etc/sshd_config should have the fololwing lines:

PermitRootLogin without-password

PubkeyAuthentication yes
@i-blis
i-blis / recipe.md
Created April 12, 2014 22:54
Hints for PostgreSQL use on OS X

Starting and stopping PostgreSQL server

Start, and stop, manually:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl -D /usr/local/var/postgres stop -s -m fast

Or let launchd start the server at login or boot:

#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@i-blis
i-blis / index.js
Created March 29, 2014 10:53
requirebin sketch
var hypotrochoid = require('hypotrochoid')
, d3 = require('d3')
var ranged = range(0, 500, 1)
var points = ranged.map(function(t) {
return hypotrochoid(70, [50, 70, 82.5], t)
})
function range(start, end, inc) {
var a = []
@i-blis
i-blis / _.md
Created March 29, 2014 00:11
movable point on circle