Skip to content

Instantly share code, notes, and snippets.

View LukasForst's full-sized avatar

Lukas Forst LukasForst

View GitHub Profile
@LukasForst
LukasForst / Dockerfile.ldap
Last active May 30, 2023 12:17
LDAP in docker container
FROM osixia/openldap
ENV LDAP_ORGANISATION="Mild Blue"
ENV LDAP_DOMAIN="slp.mild.blue"
COPY bootstrap.ldif /container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif
@LukasForst
LukasForst / CMakeLists.txt
Created December 19, 2022 11:24
CMake for Nginx
cmake_minimum_required(VERSION 3.24)
project(nginx)
set(CMAKE_CXX_STANDARD 14)
include_directories(modules/cjson-module)
include_directories(modules/lua-nginx-module/src)
include_directories(modules/lua-nginx-module/src/api)
include_directories(modules/luasocket_module/src)
include_directories(modules/ngx_brotli-module/deps/brotli/common)
@LukasForst
LukasForst / main.py
Created November 9, 2022 10:33
flask app vulnerable to timing attack on passwords
import base64
import os
import time
from functools import wraps
from flask import Flask, request, session
app = Flask(__name__)
app.secret_key = base64.b64encode(os.urandom(32))
@LukasForst
LukasForst / main.py
Created November 9, 2022 10:15
Insecure flask - session not signed
import base64
import json
import time
from functools import wraps
from flask import Flask, request, make_response
app = Flask(__name__)
books = {
@LukasForst
LukasForst / main.py
Created November 9, 2022 09:52
Insecure flask app
import base64
import os
from functools import wraps
from flask import Flask, request, session
app = Flask(__name__)
app.secret_key = base64.b64encode(os.urandom(32))
books = {
@LukasForst
LukasForst / README.md
Last active June 21, 2024 05:18
Traefik, Authentik forward auth example

Deploying Traefik using forward proxy mode with Authentik

This is an example guide how to deploy Authentik with Traefik in forward auth proxy mode - that means that any application behind the proxy will be automatically authenticated by Traefik. This allows better reuse of code and completely moves user management to Traefik & Authentik.

In this guide we use custom DNS to make the requests nicer and to show that it works with DNS. So step #1 is to put following records to your /etc/hosts (for example by sudo nano /etc/hosts and adding these values)

@LukasForst
LukasForst / citext.kt
Created April 5, 2022 15:14
CitextColumnType
/**
* Case Insensitive column type for Postgres.
*/
open class CitextColumnType : ColumnType() {
override fun sqlType(): String = "citext"
override fun readObject(rs: ResultSet, index: Int): Any? = rs.getBytes(index).decodeToString()
override fun valueFromDB(value: Any): Any = when (value) {
is Blob -> value.binaryStream.use { it.readBytes() }.decodeToString()
@LukasForst
LukasForst / echo.ts
Last active May 23, 2021 16:48
Simple Wire Bot
/**
* This is a very simple bot, that echos text it receives.
* For a sake of simplicity, we don't don any checks and assume only happy scenarios.
*
* We used Deno with Oak, to have a single executable file as short as possible without
* any boiler plate.
*
* Run as "deno run --allow-net echo.ts".
*/
import { Application, Context } from 'https://deno.land/x/oak/mod.ts';
@LukasForst
LukasForst / echo.ts
Created May 21, 2021 17:12
Super simple typescript bot for Wire
// noinspection DuplicatedCode
import { Application, Router, RouterContext } from 'https://deno.land/x/oak@v6.5.0/mod.ts';
const app = new Application();
const router = new Router();
router.post('/roman', async (ctx: RouterContext) => {
const body = await ctx.request.body({ type: 'json' }).value;
@LukasForst
LukasForst / vaccine.sh
Created March 2, 2021 10:25
Ultimate script to find out how many vaccines were thrown into garbage can so far
curl --silent https://onemocneni-aktualne.mzcr.cz/api/v2/covid-19/ockovani-spotreba.json | jq '.data[].znehodnocene_davky' | awk '{ sum += $1 } END { print sum }'