custom changes

This commit is contained in:
Hendrik Schutter 2022-03-30 14:35:26 +02:00
parent a1671883c8
commit abbeae7307
4 changed files with 44 additions and 7 deletions

View File

@ -1,7 +1,45 @@
# LegacyIP Warn
This project allows you to inject an warning banner for IPv4-users with NGINX used as a proxy.
Fork from: [https://gitlab.com/margau_me/legacyip-warn](https://gitlab.com/margau_me/legacyip-warn)
This project allows you to inject an warning banner for IPv4-users with NGINX webserver.
It consists of two snippets and an example vhost configuration.
Blog Post: [https://margau.net/posts/2020-09-06-legacyip-warn/](https://margau.net/posts/2020-09-06-legacyip-warn/)
# Install
copy `legacy-banner.conf` to `/etc/nginx/snippets/legacy-banner.conf`
copy `legacy-js.conf` to `/etc/nginx/snippets/legacy-js.conf`
Add the script to the site config like this:
geo $ipv4 {
0.0.0.0/0 ipv4;
}
server {
#Listen SSL+HTTP/2
listen 443 ssl http2;
listen [::]:443 ssl http2;
#Server Name here
include /etc/nginx/snippets/legacy-js.conf;
location / {
#normal location or proxy settings
# IP Legacy Banner
include /etc/nginx/snippets/legacy-banner.conf;
if ($ipv4 ~ "^$") {
set $legacy "<!-- uses IPv6 --></body>";
}
sub_filter "script-src 'unsafe-inline'" "script-src 'unsafe-inline'";
sub_filter "</body>" $legacy;
}
}

View File

@ -11,10 +11,10 @@ server {
include /etc/nginx/snippets/legacy-js.conf;
location / {
proxy_pass (...);
include /etc/nginx/proxy_params.conf;
#normal location or proxy settings
# IP Legacy Banner
sub_filter_types text/html;
include /etc/nginx/snippets/legacy-banner.conf;
if ($ipv4 ~ "^$") {
set $legacy "<!-- uses IPv6 --></body>";

View File

@ -26,6 +26,6 @@ set $legacy "
}
</style>
<div id='legacywarnoverlay'>
<p>Du besuchst diese Seite mit einem <strong>veralteten</strong> IPv4-Internetzugang. M&ouml;glicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte Frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterst&uuml;tzung.<br>
<p>Du besuchst diese Seite mit einem <strong>veralteten</strong> IPv4-Internetzugang. M&ouml;glicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterst&uuml;tzung.<br>
You are visiting this site with an <strong>outdated</strong> IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.<br>
<a href='https://margau.net/ipv6' target='_blank'>Weitere Infos | More Information</a><br>Klicke zum schlie&szlig;en | Click to close</p></div></body>";

View File

@ -6,13 +6,12 @@ function legacywarnon() {
function legacywarnoff() {
document.getElementById('legacywarnoverlay').style.display = 'none';
document.cookie = 'legacywarn=true; max-age=86400 ; path=/';
document.cookie = 'legacywarn=true; max-age=604800; path=/';
}
document.addEventListener('DOMContentLoaded', function(){
document.getElementById('legacywarnoverlay').onclick = legacywarnoff;
if (document.cookie.indexOf('legacywarn=') > -1) {
document.getElementById('legacywarnoverlay').style.display = 'none';
console.log('Hide Legacy IP warn');
} else {
legacywarnon();
}