On the systems which I use for web access, I got installed for years now a logout job which deletes all cookies and web storage entities – kind of tracking tabula rasa. With this in place, I cannot stay logged on to several sites, and I see the very cookie notices again and again. Because of just another GD-PR-Stunt yesterday, this started to happen now to me on the FreeBSD forums as well.
OK, enough is enough, finally I found a good use to Squid on my FreeBSD home server. It runs here as a transparent http/https proxy, and yesterday I installed on it a tiny url_rewrite_program which I named Nukie. Here is the C code:
In order the browser behind my Squid can load the notice nuker, I stored to /usr/local/www/apache24/local.obsigna.com/ the following JavaScript:
To /usr/local/etc/squid/squid.conf, I added the line url_rewrite_program /root/bin/nukie.
Nukie shall be comiled as user root:
After restarting Squid on the home server, and when visiting forums.freebsd.org, the cookie notices are removed automatically.
OK, enough is enough, finally I found a good use to Squid on my FreeBSD home server. It runs here as a transparent http/https proxy, and yesterday I installed on it a tiny url_rewrite_program which I named Nukie. Here is the C code:
C:
// nukie.c
// nukie
//
// Compilation:
// clang -g0 -O3 -march=native -Wno-parentheses nukie.c -s -o ~/bin/nukie
//
// Created by Dr. Rolf Jansen 2018-08-02.
// Copyright © 2018 obsigna.com All rights reserved.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(int argc, const char *argv[])
{
int repeatedErr = 0;
char requestSpec[8192];
while (1)
{
if (!fgets(requestSpec, 8192, stdin))
{
clearerr(stdin);
usleep(100000);
if (++repeatedErr < 10)
continue;
else
exit(1);
}
repeatedErr = 0;
if (strstr(requestSpec, "https://forums.freebsd.org/js/xf/notice.min.js"))
fprintf(stdout, "OK status=301 url=https://local.obsigna.com/Nukies/freebsd-forums-nukie.js\n");
else
fprintf(stdout, "ERR\n");
fflush(stdout);
}
return 0;
}
In order the browser behind my Squid can load the notice nuker, I stored to /usr/local/www/apache24/local.obsigna.com/ the following JavaScript:
Code:
var notices = document.getElementsByClassName('notices notices--bottom_fixer js-notices');
if (notices !== undefined && notices[0] != undefined)
notices[0].outerHTML="";
To /usr/local/etc/squid/squid.conf, I added the line url_rewrite_program /root/bin/nukie.
Nukie shall be comiled as user root:
clang -g0 -O3 -march=native -Wno-parentheses nukie.c -s -o ~/bin/nukie nukie
After restarting Squid on the home server, and when visiting forums.freebsd.org, the cookie notices are removed automatically.
Last edited: