diff --git a/.drone.yml b/.drone.yml index ae96dfa..17b85bd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,65 @@ kind: pipeline -name: default +type: docker +name: linux-amd64 + +platform: + os: linux + arch: amd64 steps: - name: docker image: plugins/docker settings: + auto_tag: true + auto_tag_suffix: linux-amd64 repo: samuelph/connectivity-check username: from_secret: USERNAME password: - from_secret: PASSWORD \ No newline at end of file + from_secret: PASSWORD + +--- +kind: pipeline +type: docker +name: linux-arm + +platform: + os: linux + arch: arm + +steps: + - name: docker + image: plugins/docker + settings: + auto_tag: true + auto_tag_suffix: linux-arm + repo: samuelph/connectivity-check + username: + from_secret: USERNAME + password: + from_secret: PASSWORD + +--- +kind: pipeline +type: docker +name: manifest + +steps: + - name: publish + image: plugins/manifest + settings: + auto_tag: true + ignore_missing: true + target: samuelph/connectivity-check + template: samuelph/connectivity-check:OS-ARCH + platforms: + - linux/amd64 + - linux/arm + username: + from_secret: USERNAME + password: + from_secret: PASSWORD + +depends_on: + - linux-amd64 + - linux-arm diff --git a/Dockerfile b/Dockerfile index 38a3f91..d6eac3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ FROM nginx COPY nginx.conf /etc/nginx/nginx.conf -COPY index.html /usr/share/nginx/html \ No newline at end of file diff --git a/README.md b/README.md index 82e5fe9..3efc689 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,95 @@ -# connectivity-check -A self-hosted captive portal connectivity check +# [connectivity-check](https://git.sp-codes.de/samuel-p/connectivity-check) + +[](https://ci.sp-codes.de/samuel-p/connectivity-check) [](#license) [](https://hub.docker.com/r/samuelph/connectivity-check) + +A self-hosted captive portal connectivity check. + +## Usage + +Just run the following command: + +```bash +docker run -d -p 80:80 -p 443:443 samuelph/connectivity-check +``` + +Or with docker-compose: + +```yaml +version: '3.4' + +services: + connectivitycheck: + image: samuelph/connectivity-check + restart: always + ports: + - 80:80 + - 443:443 +``` + +## Run on a simple web space + +Instead of running the docker image you also can just use the following `.htaccess` file on your web server: + +``` +RewriteEngine On + +Header always set "X-NetworkManager-Status" "online" + +RewriteCond "%{REQUEST_FILENAME}" "(generate)?_?204" +RewriteRule "(generate)?_?204" / [R=204,L] + +RewriteCond %{HTTPS} off +RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +``` + +## Setup your devices + +### Android + +To change the Captive Portal Check in Android, you need a terminal app or a connection via ADB to a computer. + +To use `http` you can run the following commands with the respective method: + +``` +# settings put global captive_portal_use_https 0 +# settings put global captive_portal_http_url "http://connectivitycheck.sp-codes.de/generate204" +``` + +To use `https` you can use the following two commands: + +``` +# settings put global captive_portal_use_https 1 +# settings put global captive_portal_https_url "https://connectivitycheck.sp-codes.de/generate204" +``` + +Maybe you have to reboot your phone after updating the settings. + +If you are using AFWall+ you need to give access to _[1000] Android-System_ and in some cases _[10040] CaptivePortalLogin_ to make it work. + +For more information see [here](https://android.stackexchange.com/a/186995/288049). + +### Ubuntu + +In Ubuntu, the file `/etc/NetworkManager/NetworkManager.conf` must be changed. Add or change the following lines: + +``` +[connectivity] +uri=https://connectivitycheck.sp-codes.de/generate204 +``` + +Restart the network-manager: + +``` +sudo service network-manager restart +``` + +For more information see [here](https://askubuntu.com/q/1167177/920103). + +## Firefox + +Type [about:config](about:config) in the Firefox address bar and search for `captivedetect.canonicalURL` and `network.connectivity-service`. Set the URL values to `https://connectivitycheck.sp-codes.de/generate204`, the domain values to `connectivitycheck.sp-codes.de`. That's it. + + +## License + +connectivity-check is Free Software: It is licensed under MIT (See [LICENSE](LICENSE) for more information). diff --git a/index.html b/index.html deleted file mode 100644 index 7aa1d59..0000000 --- a/index.html +++ /dev/null @@ -1,46 +0,0 @@ -<html> -<head> - <title>connectivity-check</title> -</head> - -<body> -<h1>connectivity-check</h1> - -<hr> - -<h2>Setup Android</h2> - -If you want to use <code>http</code>: -<pre># settings put global captive_portal_use_https 0</pre> -<pre># settings put global captive_portal_http_url "http://connectivitycheck.sp-codes.de/generate204"</pre> - -If you want to use <code>https</code>: -<pre># settings put global captive_portal_use_https 1</pre> -<pre># settings put global captive_portal_https_url "https://connectivitycheck.sp-codes.de/generate204"</pre> - -<p>Maybe you have to reboot your phone after updating the settings. For more information see <a href="https://android.stackexchange.com/a/186995/288049">this</a>.</p> -<p>If you are using AFWall+ you need to give access to [1000] Android-System and in some cases [10040] CaptivePortalLogin to make it work.</p> - -<hr> - -<h2>Setup Ubuntu</h2> - -Open <code>/etc/NetworkManager/NetworkManager.conf</code>: - -<pre># sudo nano /etc/NetworkManager/NetworkManager.conf</pre> - -Add the following lines (or change them to this): - -<pre> -[connectivity] -uri=https://connectivitycheck.sp-codes.de/generate204 - </pre> - -Restart the network-manager: - -<pre># sudo service network-manager restart</pre> - -<p>For more information see <a href="https://askubuntu.com/q/1167177/920103">this</a>.</p> -</body> - -</html> \ No newline at end of file