Captiveportal abschalten
Captiveportal von kuketz-blog.de nutzen[edit | edit source]
Wenn man nicht möchte, dass bei jeder Captive-Portal Prüfung Google oder Amazon weiß wann man welche IP nutzt und mit welchem Browser man surft,
oder
wenn man seinem Gerät das Internet verboten hat, weil es nur im heimischen Netzwerk nutzbar sein soll, mit der heimischen Mediathek,
dann
kann man die Abfrage ändern oder abschalten.
Vorraussetzung[edit | edit source]
Umgang mit ADB, Installation von ADB-Tools / ADB-Werkzeugen, Entwickleroptionen freigeschaltet
Android Nougat (7.x)[edit | edit source]
Verbindet das Gerät via USB-Kabel mit eurem Rechner und aktiviert ADB für den Vorgang. Über ein Terminal am Rechner setzt ihr anschließend folgende Befehle ab:
adb shell 'settings put global captive_portal_http_url "http://captiveportal.kuketz.de"' adb shell 'settings put global captive_portal_https_url "https://captiveportal.kuketz.de"'
Android Oreo (8.x) | Pie (9.x)[edit | edit source]
Verbindet das Gerät via USB-Kabel mit eurem Rechner und aktiviert ADB für den Vorgang. Über ein Terminal am Rechner setzt ihr anschließend folgende Befehle ab:
adb shell 'settings put global captive_portal_http_url "http://captiveportal.kuketz.de"' adb shell 'settings put global captive_portal_https_url "https://captiveportal.kuketz.de"' adb shell 'settings put global captive_portal_fallback_url "http://captiveportal.kuketz.de"' adb shell 'settings put global captive_portal_other_fallback_urls "http://captiveportal.kuketz.de"'
Ob die URLs wie gewünscht angepasst wurden könnt ihr mit folgendem Befehl prüfen:
adb shell 'settings get global captive_portal_https_url'
Ausgabe:
https://captiveportal.kuketz.de
Anschließend können wir via curl (von einem Rechner aus) die URL mal abfragen:
curl -I http://captiveportal.kuketz.de
Als Antwort bekommt ihr:
HTTP/1.1 204 No Content [...]
Genau diese Antwort erwartet euer Android-Telefon.
Connectivity-Check-Service selbst hosten[edit | edit source]
Alternativ zu meinem Connectivity-Check-Service könnt ihr natürlich auch selbst hosten. Via nginx geht das relativ simpel. Hier meine Konfiguration:
## SITE HANDLING HTTP ## server { ## INIT ## listen 80; server_name captiveportal.kuketz.de; root /var/www/sites/captiveportal.kuketz.de; ## LOGS ## access_log off; error_log off; ## SECURITY HEADER ## include /etc/nginx/conf/headers.conf; add_header Content-Security-Policy "default-src 'none'"; ## ENTER HERE ## location / { # Let's encrypt location location ^~ /.well-known/acme-challenge { default_type text/plain; } location = /.well-known/acme-challenge/ { return 444; } ## CAPTIVE PORTAL RESPONSE location / { return 204; } } } ## SITE HANDLING HTTPS ## server { ## INIT ## listen 443 ssl; server_name captiveportal.kuketz.de; root /var/www/sites/captiveportal.kuketz.de; ## LOGS ## access_log off; error_log off; ## SECURITY HEADER ## include /etc/nginx/conf/headers-ssl.conf; add_header Content-Security-Policy "default-src 'none'"; ## SSL ## ssl on; ssl_certificate /etc/ssl/certs/captiveportal.kuketz_ecdsa.pem; ssl_certificate_key /etc/ssl/private/captiveportal.kuketz_ecdsa.key; # OCSP-Stapling ssl_stapling on; ssl_stapling_verify on; ssl_stapling_file /etc/ssl/certs/captiveportal.kuketz_ocspresponse.der; ## CAPTIVE PORTAL RESPONSE location / { return 204; } }
Das Entscheidende ist eigentlich nur dieser kleine Teil:
## CAPTIVE PORTAL RESPONSE location / { return 204; }
Damit wird nginx auf Anfragen auf der Domain »captiveportal.kuketz.de« mit einem HTTP-204-Statuscode antworten. Mit Apache sollte das auch funktionieren (nicht verifiziert):
RewriteEngine On RewriteCond %{REQUEST_URI} / RewriteRule $ / [R=204,L]
Fazit: Ihr könnt nun also meinen Service nutzen oder den Connectiviy-Check selbst hosten. Google wird über diese Funktion jedenfalls keine Daten mehr bekommen.
Informationen zur Datenverabeitung könnt ihr der Datenschutzerklärung entnehmen.
Mike Kuketz
transcriptiert für droidwiki.org: cptechnik
Captive Portal ganz abschalten[edit | edit source]
adb shell 'settings put global captive_portal_mode 0'
Konsolenmitschnitt für euch[edit | edit source]
peter@meinpc:~$ adb shell settings list global|grep captive captive_portal_fallback_url=https://www.google.com/generate_204 captive_portal_http_url=http://tabletcaptiveportal.com/generate_204 captive_portal_https_url=http://tabletcaptiveportal.com/generate_204 captive_portal_use_https=0 peter@meinpc:~$ peter@meinpc:~$ peter@meinpc:~$ adb shell 'settings put global captive_portal_http_url "http://captiveportal.kuketz.de"' peter@meinpc:~$ adb shell settings list global|grep captive captive_portal_fallback_url=https://www.google.com/generate_204 captive_portal_http_url=http://captiveportal.kuketz.de captive_portal_https_url=http://tabletcaptiveportal.com/generate_204 captive_portal_use_https=0 peter@meinpc:~$ peter@meinpc:~$ peter@meinpc:~$ adb shell 'settings put global captive_portal_https_url "https://captiveportal.kuketz.de"' peter@meinpc:~$ adb shell 'settings put global captive_portal_https_url "https://captiveportal.kuketz.de"' peter@meinpc:~$ adb shell 'settings put global captive_portal_fallback_url "http://captiveportal.kuketz.de"' peter@meinpc:~$ adb shell settings list global|grep captive captive_portal_fallback_url=http://captiveportal.kuketz.de captive_portal_http_url=http://captiveportal.kuketz.de captive_portal_https_url=https://captiveportal.kuketz.de captive_portal_use_https=0 peter@meinpc:~$