diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif new file mode 100644 index 0000000..1e396c6 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/archlinux.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/archlinux.gif new file mode 100644 index 0000000..f2c68ab Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/archlinux.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/darth-vader.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/darth-vader.gif new file mode 100644 index 0000000..4231b6d Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/darth-vader.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/epitech.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/epitech.gif new file mode 100644 index 0000000..4f44a82 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/epitech.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/nsa.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/nsa.gif new file mode 100644 index 0000000..f74b2f7 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/nsa.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/pornhub.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/pornhub.gif new file mode 100644 index 0000000..6d86a3d Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/pornhub.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/puffy.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/puffy.gif new file mode 100644 index 0000000..08179d3 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/puffy.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif new file mode 100644 index 0000000..379b6e7 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif new file mode 100644 index 0000000..4f4a1b3 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif new file mode 100644 index 0000000..8460593 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif differ diff --git a/2019-02-24-thinkpad-custom-boot-logo/boot-logo/vim.gif b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/vim.gif new file mode 100644 index 0000000..0927de0 Binary files /dev/null and b/2019-02-24-thinkpad-custom-boot-logo/boot-logo/vim.gif differ diff --git a/404.html b/404.html new file mode 100644 index 0000000..c0e5766 --- /dev/null +++ b/404.html @@ -0,0 +1,81 @@ + + + + + + + + 404 not found + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +

404 not found

+

Maybe the page you are looking for changed its url, go home to try finding it again?

+ + + + + + +
+ + + + + diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..a023766 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +blog.x4m3.rocks \ No newline at end of file diff --git a/android-chrome-192x192.png b/android-chrome-192x192.png new file mode 100644 index 0000000..56d19b1 Binary files /dev/null and b/android-chrome-192x192.png differ diff --git a/android-chrome-512x512.png b/android-chrome-512x512.png new file mode 100644 index 0000000..a39973f Binary files /dev/null and b/android-chrome-512x512.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png new file mode 100644 index 0000000..7d8cc91 Binary files /dev/null and b/apple-touch-icon.png differ diff --git a/archlinux-how-old-is-your-installation/index.html b/archlinux-how-old-is-your-installation/index.html new file mode 100644 index 0000000..5c6d19f --- /dev/null +++ b/archlinux-how-old-is-your-installation/index.html @@ -0,0 +1,94 @@ + + + + + + + + archlinux how old is your installation · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

archlinux how old is your installation

+ + +

Posted on

+ + +

on archlinux, to see when you installed arch on your computer, run this command

+
sed -n "/ installed $1/{s/].*/]/p;q}" /var/log/pacman.log
+
+

it will display the date and the time when you ran pacstrap on the live cd to install your system.

+

on my laptop, i get [2018-10-21 21:05], which is when i switched from fedora back to arch because my school required fedora.

+ +
+ + + + + + +
+ + + + + diff --git a/atom.xml b/atom.xml new file mode 100644 index 0000000..279d8ad --- /dev/null +++ b/atom.xml @@ -0,0 +1,1330 @@ + + + deadbaed + broke my bed now it's dead + + + Zola + 2023-07-15T00:00:00+00:00 + https://blog.x4m3.rocks/atom.xml + + Setup a private Docker registry + 2023-07-15T00:00:00+00:00 + 2023-07-15T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/docker-private-registry/ + + <p>My internal infrastructure is complete. I can now work on my projects, but at some point they need to go out to the world!</p> +<p>The platform for most of my projects is the web, and the best tool I found so far to deploy them is Docker.</p> +<p>I want to keep the code on the private infrastructure, but I also want to be in control of where the docker images will be stored.</p> +<p>The perfect solution is a private Docker registry! But it will not be on the internal infrastructure, it will be publicly available on a regular server.</p> +<p>That way, projects can be deployed in their final form whenever and wherever, while the source remaining private.</p> +<h1 id="get-started-locally">Get started locally</h1> +<p>To start, I will launch a test registry on my machine to make sure everything works.</p> +<p>I will use these docker images:</p> +<ul> +<li><a href="https://hub.docker.com/_/registry">registry</a>: The official registry made by Docker themselves</li> +<li><a href="https://joxit.dev/docker-registry-ui">docker-registry-ui</a>: A nice webui to view and manage images on the registry</li> +</ul> +<p>Here's the docker-compose file I used to get started:</p> +<pre data-lang="yaml" style="background-color:#fcf0ca;color:#282828aa;" class="language-yaml "><code class="language-yaml" data-lang="yaml"><span style="font-weight:bold;color:#407959;">services</span><span>: +</span><span> +</span><span> </span><span style="font-weight:bold;color:#407959;">registry-server</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">image</span><span>: </span><span style="color:#79740e;">registry:2.8.2 +</span><span> </span><span style="font-weight:bold;color:#407959;">ports</span><span>: +</span><span> - </span><span style="color:#79740e;">5000:5000 +</span><span> </span><span style="font-weight:bold;color:#407959;">volumes</span><span>: +</span><span> - </span><span style="color:#79740e;">./registry-data:/var/lib/registry +</span><span> - </span><span style="color:#79740e;">./passwords:/auth/htpasswd +</span><span> </span><span style="font-weight:bold;color:#407959;">environment</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH</span><span>: </span><span style="color:#79740e;">&#39;htpasswd&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH_HTPASSWD_REALM</span><span>: </span><span style="color:#79740e;">&#39;Registry Realm&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH_HTPASSWD_PATH</span><span>: </span><span style="color:#79740e;">&#39;/auth/htpasswd&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Origin</span><span>: </span><span style="color:#79740e;">&#39;[http://registry.example.com]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods</span><span>: </span><span style="color:#79740e;">&#39;[HEAD,GET,OPTIONS,DELETE]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Credentials</span><span>: </span><span style="color:#79740e;">&#39;[true]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers</span><span>: </span><span style="color:#79740e;">&#39;[Authorization,Accept,Cache-Control]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers</span><span>: </span><span style="color:#79740e;">&#39;[Docker-Content-Digest]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_STORAGE_DELETE_ENABLED</span><span>: </span><span style="color:#79740e;">&#39;true&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">container_name</span><span>: </span><span style="color:#79740e;">registry-server +</span><span> +</span><span> </span><span style="font-weight:bold;color:#407959;">registry-ui</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">image</span><span>: </span><span style="color:#79740e;">joxit/docker-registry-ui:2.5.0 +</span><span> </span><span style="font-weight:bold;color:#407959;">ports</span><span>: +</span><span> - </span><span style="color:#79740e;">8001:80 +</span><span> </span><span style="font-weight:bold;color:#407959;">environment</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">SINGLE_REGISTRY</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_TITLE</span><span>: </span><span style="color:#79740e;">Docker Registry UI +</span><span> </span><span style="font-weight:bold;color:#407959;">DELETE_IMAGES</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">SHOW_CONTENT_DIGEST</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">NGINX_PROXY_PASS_URL</span><span>: </span><span style="color:#79740e;">http://registry-server:5000 +</span><span> </span><span style="font-weight:bold;color:#407959;">SHOW_CATALOG_NB_TAGS</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_MIN_BRANCHES</span><span>: </span><span style="color:#8f3f71;">1 +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_MAX_BRANCHES</span><span>: </span><span style="color:#8f3f71;">1 +</span><span> </span><span style="font-weight:bold;color:#407959;">TAGLIST_PAGE_SIZE</span><span>: </span><span style="color:#8f3f71;">100 +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_SECURED</span><span>: </span><span style="color:#8f3f71;">false +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_ELEMENTS_LIMIT</span><span>: </span><span style="color:#8f3f71;">1000 +</span><span> </span><span style="font-weight:bold;color:#407959;">container_name</span><span>: </span><span style="color:#79740e;">registry-ui +</span></code></pre> +<p>But don't start the services right away.</p> +<h1 id="authentication">Authentication</h1> +<p>I don't want the registry being open to everyone though, let's add some authentication.</p> +<p>To keep things simple, I will use HTTP basic auth. If you want, there's a possibility to have a more <a href="https://docs.docker.com/registry/spec/auth/">complex setup</a>.</p> +<p>Here's a quick script to get passwords in a format that Docker will accept:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="font-style:italic;color:#928374;">#!/bin/sh +</span><span style="font-style:italic;color:#928374;"># +</span><span style="font-style:italic;color:#928374;"># new-password.sh +</span><span> +</span><span style="color:#9d0006;">if </span><span style="color:#b57614;">[ </span><span style="color:#282828;">-z </span><span style="color:#79740e;">&quot;$</span><span style="color:#282828;">1</span><span style="color:#79740e;">&quot; </span><span style="color:#b57614;">] +</span><span style="color:#9d0006;">then +</span><span style="color:#b57614;">echo </span><span style="color:#79740e;">&quot;usage: $</span><span style="color:#282828;">0</span><span style="color:#79740e;"> username&quot; +</span><span style="color:#b57614;">exit</span><span style="color:#282828;"> 1 +</span><span style="color:#9d0006;">fi +</span><span> +</span><span style="color:#b57614;">echo </span><span style="color:#79740e;">&quot;creating password for user \&quot;$</span><span style="color:#282828;">1</span><span style="color:#79740e;">\&quot;&quot; +</span><span style="color:#282828;">htpasswd -nB $1 +</span></code></pre> +<p>How to use it:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">$ ./new-password.sh phil +</span><span style="color:#282828;">creating password for user </span><span style="color:#79740e;">&quot;phil&quot; +</span><span style="color:#282828;">New password: phil +</span><span style="color:#282828;">Re-type new password: phil +</span><span style="color:#282828;">phil:$2y$05$asxsqfmEQJpg8zuKGyieMOmTirok.Gd/noliF.y48DJXe.97ufGHG +</span></code></pre> +<p>Copy the last line in the <code>passwords</code> file (see the <code>docker-compose</code> file).</p> +<p>Repeat the process for every user you want to give authentication to your registry.</p> +<p>Keep in mind I only cover <strong>AUTHENTICATION</strong> (who can access the registry), and not <strong>AUTHORIZATION</strong> (who can do what on the registry). With this setup, if you have access to the registry, you can do anything on it.</p> +<h1 id="use-the-registry">Use the registry</h1> +<p>Start the services with</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">docker compose up +</span></code></pre> +<p>Now, you can access the webui by going to</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>http://localhost:8001 +</span></code></pre> +<p>in a web browser and sign-in with your credentials. You should see an empty list. Let's add some images!</p> +<h2 id="naming-images">Naming images</h2> +<p>Pick an image you want on the registry.</p> +<p>If it's an existing image:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">docker tag name-of-existing-image localhost:5000/existing-image-name +</span></code></pre> +<p>If you build the image directly:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">docker build -t localhost:5000/new-image-name +</span></code></pre> +<p>The name of the image must have the domain of the registry, in our case it's <code>localhost:5000</code>.</p> +<h2 id="login-to-registry">Login to registry</h2> +<p>To sign in to the registry, use</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">docker login localhost:5000 +</span></code></pre> +<p>and enter your credentials.</p> +<h2 id="push-pull">Push / Pull</h2> +<p>Simply run the usual docker command to push or pull images. Docker will know which registry to use based of the image's name.</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">docker push localhost:5000/new-image-name +</span><span style="color:#282828;">docker pull localhost:5000/existing-image-name +</span></code></pre> +<p>That's pretty much it!</p> +<h1 id="deploy-to-production">Deploy to production</h1> +<p>I use <a href="https://caprover.com">Caprover</a> to deploy my docker images easily, it comes with a reverse proxy and automatic TLS certificates with Let's encrypt.</p> +<p>Here's the one-click-app config I created for the registry:</p> +<pre data-lang="yaml" style="background-color:#fcf0ca;color:#282828aa;" class="language-yaml "><code class="language-yaml" data-lang="yaml"><span style="font-weight:bold;color:#407959;">captainVersion</span><span>: </span><span style="color:#8f3f71;">4 +</span><span> +</span><span style="font-weight:bold;color:#407959;">services</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">$$cap_appname-registry</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">image</span><span>: </span><span style="color:#79740e;">registry:$$cap_registry_version +</span><span> </span><span style="font-weight:bold;color:#407959;">volumes</span><span>: +</span><span> - </span><span style="color:#79740e;">$$cap_appname-data:/var/lib/registry +</span><span> - </span><span style="color:#79740e;">$$cap_appname-auth:/auth/ +</span><span> </span><span style="font-weight:bold;color:#407959;">environment</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH</span><span>: </span><span style="color:#79740e;">&#39;htpasswd&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH_HTPASSWD_REALM</span><span>: </span><span style="color:#79740e;">&#39;Registry Realm&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_AUTH_HTPASSWD_PATH</span><span>: </span><span style="color:#79740e;">&#39;/auth/htpasswd&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Origin</span><span>: </span><span style="color:#79740e;">&#39;[https://$$cap_appname-registry.$$cap_root_domain, https://$$cap_appname-ui.$$cap_root_domain]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods</span><span>: </span><span style="color:#79740e;">&#39;[HEAD,GET,OPTIONS,DELETE]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Credentials</span><span>: </span><span style="color:#79740e;">&#39;[true]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers</span><span>: </span><span style="color:#79740e;">&#39;[Authorization,Accept,Cache-Control]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers</span><span>: </span><span style="color:#79740e;">&#39;[Docker-Content-Digest]&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_STORAGE_DELETE_ENABLED</span><span>: </span><span style="color:#79740e;">&#39;true&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">caproverExtra</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">containerHttpPort</span><span>: </span><span style="color:#79740e;">&#39;5000&#39; +</span><span> +</span><span> </span><span style="font-weight:bold;color:#407959;">$$cap_appname-ui</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">image</span><span>: </span><span style="color:#79740e;">joxit/docker-registry-ui:$$cap_ui_version +</span><span> </span><span style="font-weight:bold;color:#407959;">environment</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">SINGLE_REGISTRY</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_TITLE</span><span>: </span><span style="color:#79740e;">Docker Registry UI +</span><span> </span><span style="font-weight:bold;color:#407959;">DELETE_IMAGES</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">SHOW_CONTENT_DIGEST</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">NGINX_PROXY_PASS_URL</span><span>: </span><span style="color:#79740e;">http://srv-captain--$$cap_appname-registry:5000 +</span><span> </span><span style="font-weight:bold;color:#407959;">SHOW_CATALOG_NB_TAGS</span><span>: </span><span style="color:#8f3f71;">true +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_MIN_BRANCHES</span><span>: </span><span style="color:#8f3f71;">1 +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_MAX_BRANCHES</span><span>: </span><span style="color:#8f3f71;">1 +</span><span> </span><span style="font-weight:bold;color:#407959;">TAGLIST_PAGE_SIZE</span><span>: </span><span style="color:#8f3f71;">100 +</span><span> </span><span style="font-weight:bold;color:#407959;">REGISTRY_SECURED</span><span>: </span><span style="color:#8f3f71;">false +</span><span> </span><span style="font-weight:bold;color:#407959;">CATALOG_ELEMENTS_LIMIT</span><span>: </span><span style="color:#8f3f71;">1000 +</span><span> +</span><span style="font-weight:bold;color:#407959;">caproverOneClickApp</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">variables</span><span>: +</span><span> - </span><span style="font-weight:bold;color:#407959;">id</span><span>: </span><span style="color:#79740e;">&#39;$$cap_registry_version&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">label</span><span>: </span><span style="color:#79740e;">Registry Version +</span><span> </span><span style="font-weight:bold;color:#407959;">defaultValue</span><span>: </span><span style="color:#79740e;">&#39;2.8.2&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">description</span><span>: </span><span style="color:#79740e;">Check out the Docker page for the valid tags https://hub.docker.com/_/registry/tags +</span><span> </span><span style="font-weight:bold;color:#407959;">validRegex</span><span>: </span><span style="color:#79740e;">&quot;/.{1,}/&quot; +</span><span> - </span><span style="font-weight:bold;color:#407959;">id</span><span>: </span><span style="color:#79740e;">&#39;$$cap_ui_version&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">label</span><span>: </span><span style="color:#79740e;">UI Version +</span><span> </span><span style="font-weight:bold;color:#407959;">defaultValue</span><span>: </span><span style="color:#79740e;">&#39;2.5.0&#39; +</span><span> </span><span style="font-weight:bold;color:#407959;">description</span><span>: </span><span style="color:#79740e;">Check out the Docker page for the valid tags https://hub.docker.com/r/joxit/docker-registry-ui/tags +</span><span> </span><span style="font-weight:bold;color:#407959;">validRegex</span><span>: </span><span style="color:#79740e;">&quot;/.{1,}/&quot; +</span><span> </span><span style="font-weight:bold;color:#407959;">instructions</span><span>: +</span><span> </span><span style="font-weight:bold;color:#407959;">start</span><span>: </span><span style="color:#9d0006;">|- +</span><span style="color:#79740e;"> A private docker registry, with a webui to see images +</span><span> </span><span style="font-weight:bold;color:#407959;">end</span><span>: </span><span style="color:#9d0006;">|- +</span><span style="color:#79740e;"> The registry has been deployed! Look in the &quot;auth&quot; volume to update credentials +</span><span> </span><span style="font-weight:bold;color:#407959;">displayName</span><span>: </span><span style="color:#79740e;">docker-registry-with-ui +</span><span> </span><span style="font-weight:bold;color:#407959;">isOfficial</span><span>: </span><span style="color:#8f3f71;">false +</span><span> </span><span style="font-weight:bold;color:#407959;">description</span><span>: </span><span style="color:#79740e;">A private docker registry, with a webui to see images +</span><span> </span><span style="font-weight:bold;color:#407959;">documentation</span><span>: </span><span style="color:#79740e;">https://docs.docker.com/registry/ +</span></code></pre> + + + + + Setup a service on our internal infrastructure on Alpine Linux + 2023-07-02T00:00:00+00:00 + 2023-07-02T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/service-internal-infra-alpine/ + + <p>Now we have a basic internal infrastructure with:</p> +<ul> +<li>Everything hidden and encrypted through the network (WireGuard)</li> +<li>Pretty internal domain names instead of raw ip addresses (CoreDNS)</li> +<li>A basic http server just in case (Caddy)</li> +<li>Our own TLS certificates that are easy to get (Step CA)</li> +</ul> +<p>But everything is on the same machine. While it could be okay, I will host the services I want on other machines.</p> +<p>I will run them on the same Proxmox cluster, but the possibilities are endless (as long you can get WireGuard running).</p> +<h1 id="get-started">Get started</h1> +<p>Install Alpine. Setup ssh and repositories.</p> +<h1 id="wireguard">WireGuard</h1> +<p>We will set up WireGuard, but not a server, a regular peer that will connect to the WireGuard server.</p> +<p>Create a new peer on the WireGuard server, and get the config file ready.</p> +<h2 id="install">Install</h2> +<p>Install WireGuard:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add wireguard-tools +</span></code></pre> +<p>To load the WireGuard module on startup, edit</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/modules +</span></code></pre> +<p>and simply add</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>wireguard +</span></code></pre> +<p>and reboot.</p> +<h2 id="configure">Configure</h2> +<p>Put the WireGuard config to</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/wireguard/wg0.conf +</span></code></pre> +<h2 id="start">Start</h2> +<p>Copy the <code>init.d</code> script for WireGuard like we did for the original server.</p> +<p>And ask it to start on boot.</p> +<p>Reboot and make sure everything works, you should see WireGuard logs when the machine is starting.</p> +<p>And the DNS should be working! Try to ping an internal DNS name.</p> +<p>Sometimes the DNS will go back to the system's default (probably your DHCP server's), so force the DNS as seen in the post about CoreDNS.</p> +<h1 id="dns-entry">DNS entry</h1> +<p>In the main server, edit CoreDNS to add a new DNS entry for the newly added peer.</p> +<p>Save and restart CoreDNS.</p> +<h1 id="motd">MOTD</h1> +<p>Add the dynamic MOTD if you feel like it. I did.</p> +<h1 id="reverse-proxy">Reverse proxy</h1> +<p>Before installing and starting services, let's add a reverse proxy for security + some sweet TLS certs.</p> +<p>I'll be using caddy. You will need to enable the <code>community</code> repo first.</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add caddy +</span></code></pre> +<p>Let's get a hello world:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">/etc/caddy/Caddyfile +</span></code></pre> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span># global +</span><span>{ +</span><span> # step-ca ACME server +</span><span> acme_ca https://10.131.111.1:444/acme/acme/directory +</span><span>} +</span><span> +</span><span>docker.philt3r docker.philt3r:80 { +</span><span> respond &quot;Hello, world!&quot; +</span><span>} +</span></code></pre> +<p>I start the service on ports <code>80</code> and <code>443</code> to get the initial TLS certificate, I will remove access on port <code>80</code> afterward.</p> +<p>Don't start caddy yet.</p> +<h1 id="tls-certificates">TLS certificates</h1> +<p>On our new server, we need to trust the root ca. Download the root ca, and ask the system to trust it:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add ca-certificates ca-certificates-bundle +</span><span style="color:#282828;">wget --no-check-certificate https://10.131.111.1:444/roots.pem -O /usr/local/share/ca-certificates/philt3r.crt +</span><span style="color:#282828;">update-ca-certificates +</span></code></pre> +<p>Now we can start caddy and enable it on boot:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">rc-service caddy start +</span><span style="color:#282828;">rc-update add caddy +</span></code></pre> +<p>You should get a Hello World on port 443. If you do, you can disable access from port <code>80</code> in the Caddyfile and restart caddy.</p> +<h1 id="install-the-service">Install the service</h1> +<p>Now we can install the service we want to host, start it, and configure caddy to be a reverse proxy for it.</p> +<p>Repeat the process for the other services you want to host.</p> +<p>Protip: serve the services on <code>127.0.0.1</code> and use caddy to restrict access only from the WireGuard peers (since there is the DNS restriction).</p> +<p>Sample <code>Caddyfile</code>:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span># global +</span><span>{ +</span><span> # step-ca ACME server +</span><span> acme_ca https://10.131.111.1:444/acme/acme/directory +</span><span>} +</span><span> +</span><span>docker.philt3r { +</span><span> reverse_proxy 127.0.0.1:3000 +</span><span>} +</span></code></pre> +<h1 id="docker">Docker</h1> +<p>Since I'll be using Docker to host most services, I'll install it:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add docker docker-compose +</span><span style="color:#282828;">rc-update add docker +</span><span style="color:#282828;">rc-service docker start +</span></code></pre> +<p>Then spin up your docker containers and route them with caddy.</p> + + + + + Dynamic MOTD on Alpine Linux + 2023-06-30T00:00:00+00:00 + 2023-06-30T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/dynamic-motd-alpine/ + + <p>When we sign in to our server, the message of the day (MOTD) is pretty lame. Let's get something better!</p> +<p>This is the default MOTD of alpine:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>Welcome to Alpine! +</span><span> +</span><span>The Alpine Wiki contains a large amount of how-to guides and general +</span><span>information about administrating Alpine systems. +</span><span>See &lt;http://wiki.alpinelinux.org&gt;. +</span><span> +</span><span>You can setup the system with the command: setup-alpine +</span><span> +</span><span>You may change this message by editing /etc/motd. +</span></code></pre> +<p>And here's my new MOTD. I even show the WireGuard ip address:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span> +</span><span> +</span><span> Name: intra.philt3r +</span><span> Kernel: 6.1.35-0-lts +</span><span> Distro: Alpine Linux v3.18 +</span><span> Version 3.18.2 +</span><span> +</span><span> Uptime: 0 days, 0 hours, 22 minutes +</span><span> CPU Load: 0.00, 0.00, 0.00 +</span><span> +</span><span> Memory: 468M +</span><span> Free Memory: 217M +</span><span> +</span><span> Disk: 6.6G +</span><span> Free Disk: 6.6G +</span><span> +</span><span> eth0 Address: 192.168.1.71 +</span><span> wg0 Address: 10.131.111.1 +</span><span> +</span><span> +</span></code></pre> +<p>Start and enable cron at startup (it should be installed by default):</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">rc-service crond start +</span><span style="color:#282828;">rc-update add crond +</span></code></pre> +<p>Let's run a script every 15 minutes to update the <code>/etc/motd</code> file:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/periodic/15min/motd +</span></code></pre> +<p>Here's the content of my MOTD:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="font-style:italic;color:#928374;">#!/bin/sh +</span><span style="font-style:italic;color:#928374;">#. /etc/os-release +</span><span style="color:#282828;">PRETTY_NAME</span><span style="color:#b23c15;">=</span><span style="color:#282828;">`awk -F</span><span style="color:#b23c15;">= </span><span style="color:#79740e;">&#39;$1==&quot;PRETTY_NAME&quot; { print $2 ;}&#39;</span><span style="color:#282828;"> /etc/os-release </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tr -d </span><span style="color:#79740e;">&#39;&quot;&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;">VERSION_ID</span><span style="color:#b23c15;">=</span><span style="color:#282828;">`awk -F</span><span style="color:#b23c15;">= </span><span style="color:#79740e;">&#39;$1==&quot;VERSION_ID&quot; { print $2 ;}&#39;</span><span style="color:#282828;"> /etc/os-release` +</span><span style="color:#282828;">UPTIME_DAYS</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">$(</span><span style="color:#282828;">expr `cat /proc/uptime </span><span style="color:#b23c15;">| </span><span style="color:#282828;">cut -d </span><span style="color:#79740e;">&#39;.&#39;</span><span style="color:#282828;"> -f1` % 31556926 / 86400</span><span style="color:#79740e;">) +</span><span style="color:#282828;">UPTIME_HOURS</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">$(</span><span style="color:#282828;">expr `cat /proc/uptime </span><span style="color:#b23c15;">| </span><span style="color:#282828;">cut -d </span><span style="color:#79740e;">&#39;.&#39;</span><span style="color:#282828;"> -f1` % 31556926 % 86400 / 3600</span><span style="color:#79740e;">) +</span><span style="color:#282828;">UPTIME_MINUTES</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">$(</span><span style="color:#282828;">expr `cat /proc/uptime </span><span style="color:#b23c15;">| </span><span style="color:#282828;">cut -d </span><span style="color:#79740e;">&#39;.&#39;</span><span style="color:#282828;"> -f1` % 31556926 % 86400 % 3600 / 60</span><span style="color:#79740e;">) +</span><span style="color:#282828;">cat </span><span style="color:#b23c15;">&gt;</span><span style="color:#282828;"> /etc/motd </span><span style="color:#b23c15;">&lt;&lt; </span><span style="color:#9d0006;">EOF +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> Name: `hostname` +</span><span style="color:#282828;"> Kernel: `uname -r` +</span><span style="color:#282828;"> Distro: $PRETTY_NAME +</span><span style="color:#282828;"> Version $VERSION_ID +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> Uptime: $UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes +</span><span style="color:#282828;"> CPU Load: `cat /proc/loadavg </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk </span><span style="color:#79740e;">&#39;{print $1 &quot;, &quot; $2 &quot;, &quot; $3}&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> Memory: `free -m </span><span style="color:#b23c15;">| </span><span style="color:#282828;">head -n 2 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tail -n 1 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk {</span><span style="color:#79740e;">&#39;print $2&#39;</span><span style="color:#282828;">}`M +</span><span style="color:#282828;"> Free Memory: `free -m </span><span style="color:#b23c15;">| </span><span style="color:#282828;">head -n 2 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tail -n 1 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk {</span><span style="color:#79740e;">&#39;print $4&#39;</span><span style="color:#282828;">}`M +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> Disk: `df -h / </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk </span><span style="color:#79740e;">&#39;{ a = $2 } END { print a }&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;"> Free Disk: `df -h / </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk </span><span style="color:#79740e;">&#39;{ a = $2 } END { print a }&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> eth0 Address: `ifconfig eth0 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">grep </span><span style="color:#79740e;">&quot;inet addr&quot; </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk -F: </span><span style="color:#79740e;">&#39;{print $2}&#39; </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk </span><span style="color:#79740e;">&#39;{print $1}&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;"> wg0 Address: `ifconfig wg0 </span><span style="color:#b23c15;">| </span><span style="color:#282828;">grep </span><span style="color:#79740e;">&quot;inet addr&quot; </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk -F: </span><span style="color:#79740e;">&#39;{print $2}&#39; </span><span style="color:#b23c15;">| </span><span style="color:#282828;">awk </span><span style="color:#79740e;">&#39;{print $1}&#39;</span><span style="color:#282828;">` +</span><span style="color:#282828;"> +</span><span style="color:#282828;"> +</span><span style="color:#9d0006;">EOF +</span></code></pre> +<p>Make the script executable, and check if it's good:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">chmod a+x /etc/periodic/15min/motd +</span><span style="color:#282828;">run-parts --test /etc/periodic/15min +</span></code></pre> +<p>If you're lazy and don't want to wait 15 minutes, run the script directly:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">/etc/periodic/15min/motd +</span></code></pre> +<p>Log out and log back in, you should see the new MOTD!</p> +<h1 id="resources">Resources</h1> +<p><a href="https://kingtam.win/archives/apline-custom.html">https://kingtam.win/archives/apline-custom.html</a></p> +<p>I just copy/pasted and changed the MOTD.</p> + + + + + Setup Caddy with a CA and ACME server on Alpine Linux + 2023-06-28T00:00:00+00:00 + 2023-06-28T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/caddy-ca-acme-alpine/ + + <p>Now that we have a WireGuard VPN with an awesome internal DNS server, let's get a web server with HTTPS!</p> +<h1 id="caddy">Caddy</h1> +<h2 id="install">Install</h2> +<p>You will need to enable the <code>community</code> repo first.</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas apk add caddy +</span></code></pre> +<h2 id="configuration">Configuration</h2> +<p>Create a folder to serve stuff from, I placed it in</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/srv/www +</span></code></pre> +<p>Create the config in</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">/etc/caddy/Caddyfile +</span></code></pre> +<p>Here's the config, it's very simple to get started:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>intra.philt3r:80 +</span><span>root * /srv/www +</span><span>file_server browse +</span></code></pre> +<p>This config will only launch an HTTP server, the HTTPS will come later.</p> +<p>It should work only from the WireGuard peers, since they can resolve the DNS name <code>intra.philt3r</code>.</p> +<p>If there is no <code>index.html</code> in the folder, it will serve static files directly.</p> +<h2 id="script-to-launch">Script to launch</h2> +<p>Caddy already has a service!</p> +<ul> +<li>Start: <code>rc-service caddy start</code></li> +<li>Stop: <code>rc-service caddy stop</code></li> +<li>Reload configuration without downtime: <code>rc-service caddy reload</code></li> +</ul> +<h1 id="generate-keys-and-certificates">Generate keys and certificates</h1> +<p>We will generate the Root CA, the Intermediate CA.</p> +<p>Generate these with <code>openssl</code> installed on a computer, preferabbly offline.</p> +<p>Make sure the keys are stored in a safe place, I will store mine inside of a KeePassXC keystore.</p> +<h2 id="openssl-configuration">OpenSSL Configuration</h2> +<p>inside a folder, create a file</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>config.conf +</span></code></pre> +<p>In <code>[CA_root]</code>, make sure to put your folder <code>dir</code></p> +<pre data-lang="ini" style="background-color:#fcf0ca;color:#282828aa;" class="language-ini "><code class="language-ini" data-lang="ini"><span style="font-style:italic;color:#928374;"># OpenSSL root CA configuration file. +</span><span> +</span><span style="color:#9d0006;">[ ca ] +</span><span style="font-style:italic;color:#928374;"># `man ca` +</span><span style="color:#282828;">default_ca </span><span style="color:#b23c15;">=</span><span> CA_root +</span><span> +</span><span style="color:#9d0006;">[ CA_root ] +</span><span style="font-style:italic;color:#928374;"># Directory and file locations. +</span><span style="color:#282828;">dir </span><span style="color:#b23c15;">= /</span><span>home</span><span style="color:#b23c15;">/</span><span>phil</span><span style="color:#b23c15;">/</span><span>ca +</span><span style="color:#282828;">certs </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>certs +</span><span style="color:#282828;">crl_dir </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>crl +</span><span style="color:#282828;">new_certs_dir </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>newcerts +</span><span style="color:#282828;">database </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>index</span><span style="color:#b23c15;">.</span><span>txt +</span><span style="color:#282828;">serial </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>serial +</span><span style="color:#b57614;">RANDFILE </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>private</span><span style="color:#b23c15;">/.</span><span>rand +</span><span> +</span><span style="font-style:italic;color:#928374;"># The root key and root certificate. +</span><span style="font-style:italic;color:#928374;"># Match names with Smallstep naming convention +</span><span style="color:#282828;">private_key </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>root_ca_key +</span><span style="color:#282828;">certificate </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>root_ca</span><span style="color:#b23c15;">.</span><span>crt +</span><span> +</span><span style="font-style:italic;color:#928374;"># For certificate revocation lists. +</span><span style="color:#282828;">crlnumber </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>crlnumber +</span><span style="color:#282828;">crl </span><span style="color:#b23c15;">= </span><span style="color:#9d0006;">$dir</span><span style="color:#b23c15;">/</span><span>crl</span><span style="color:#b23c15;">/</span><span>ca</span><span style="color:#b23c15;">.</span><span>crl</span><span style="color:#b23c15;">.</span><span>pem +</span><span style="color:#282828;">crl_extensions </span><span style="color:#b23c15;">=</span><span> crl_ext +</span><span style="color:#282828;">default_crl_days </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">30 +</span><span> +</span><span style="font-style:italic;color:#928374;"># SHA-1 is deprecated, so use SHA-2 instead. +</span><span style="color:#282828;">default_md </span><span style="color:#b23c15;">=</span><span> sha256 +</span><span> +</span><span style="color:#282828;">name_opt </span><span style="color:#b23c15;">=</span><span> ca_default +</span><span style="color:#282828;">cert_opt </span><span style="color:#b23c15;">=</span><span> ca_default +</span><span style="color:#282828;">default_days </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">25202 +</span><span style="color:#282828;">preserve </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">no +</span><span style="color:#282828;">policy </span><span style="color:#b23c15;">=</span><span> policy_strict +</span><span> +</span><span style="color:#9d0006;">[ policy_strict ] +</span><span style="font-style:italic;color:#928374;"># The root CA should only sign intermediate certificates that match. +</span><span style="font-style:italic;color:#928374;"># See the POLICY FORMAT section of `man ca`. +</span><span style="color:#282828;">countryName </span><span style="color:#b23c15;">=</span><span> match +</span><span style="color:#282828;">stateOrProvinceName </span><span style="color:#b23c15;">=</span><span> supplied +</span><span style="color:#282828;">localityName </span><span style="color:#b23c15;">=</span><span> supplied +</span><span style="color:#282828;">organizationName </span><span style="color:#b23c15;">=</span><span> match +</span><span style="color:#282828;">commonName </span><span style="color:#b23c15;">=</span><span> supplied +</span><span> +</span><span style="color:#9d0006;">[ req ] +</span><span style="font-style:italic;color:#928374;"># Options for the `req` tool (`man req`). +</span><span style="color:#282828;">default_bits </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">4096 +</span><span style="color:#282828;">distinguished_name </span><span style="color:#b23c15;">=</span><span> req_distinguished_name +</span><span style="color:#282828;">string_mask </span><span style="color:#b23c15;">=</span><span> utf8only +</span><span> +</span><span style="font-style:italic;color:#928374;"># SHA-1 is deprecated, so use SHA-2 instead. +</span><span style="color:#282828;">default_md </span><span style="color:#b23c15;">=</span><span> sha256 +</span><span> +</span><span style="font-style:italic;color:#928374;"># Extension to add when the -x509 option is used. +</span><span style="color:#282828;">x509_extensions </span><span style="color:#b23c15;">=</span><span> v3_ca +</span><span> +</span><span style="color:#9d0006;">[ req_distinguished_name ] +</span><span style="font-style:italic;color:#928374;"># See &lt;https://en.wikipedia.org/wiki/Certificate_signing_request&gt;. +</span><span style="color:#282828;">countryName </span><span style="color:#b23c15;">=</span><span> Country (</span><span style="color:#8f3f71;">2</span><span> letter code) +</span><span style="color:#282828;">stateOrProvinceName </span><span style="color:#b23c15;">=</span><span> State or Region +</span><span style="color:#282828;">localityName </span><span style="color:#b23c15;">=</span><span> City +</span><span style="color:#282828;">commonName </span><span style="color:#b23c15;">=</span><span> Common Name +</span><span style="color:#8f3f71;">0</span><span style="color:#b23c15;">.</span><span>organizationName </span><span style="color:#b23c15;">=</span><span> Organization Name +</span><span> +</span><span style="color:#9d0006;">[ v3_ca ] +</span><span style="font-style:italic;color:#928374;"># Extensions for a typical CA (`man x509v3_config`). +</span><span style="color:#282828;">subjectKeyIdentifier </span><span style="color:#b23c15;">=</span><span> hash +</span><span style="color:#282828;">authorityKeyIdentifier </span><span style="color:#b23c15;">=</span><span> keyid</span><span style="color:#b23c15;">:</span><span>always</span><span style="color:#b23c15;">,</span><span>issuer +</span><span style="color:#282828;">basicConstraints </span><span style="color:#b23c15;">=</span><span> critical</span><span style="color:#b23c15;">, </span><span style="color:#b57614;">CA</span><span style="color:#b23c15;">:</span><span style="color:#8f3f71;">true +</span><span style="color:#282828;">keyUsage </span><span style="color:#b23c15;">=</span><span> critical</span><span style="color:#b23c15;">,</span><span> digitalSignature</span><span style="color:#b23c15;">,</span><span> cRLSign</span><span style="color:#b23c15;">,</span><span> keyCertSign +</span><span> +</span><span style="color:#9d0006;">[ v3_intermediate_ca ] +</span><span style="font-style:italic;color:#928374;"># Extensions for a typical intermediate CA (`man x509v3_config`). +</span><span style="color:#282828;">subjectKeyIdentifier </span><span style="color:#b23c15;">=</span><span> hash +</span><span style="color:#282828;">authorityKeyIdentifier </span><span style="color:#b23c15;">=</span><span> keyid</span><span style="color:#b23c15;">:</span><span>always</span><span style="color:#b23c15;">,</span><span>issuer +</span><span style="color:#282828;">basicConstraints </span><span style="color:#b23c15;">=</span><span> critical</span><span style="color:#b23c15;">, </span><span style="color:#b57614;">CA</span><span style="color:#b23c15;">:</span><span style="color:#8f3f71;">true</span><span style="color:#b23c15;">,</span><span> pathlen</span><span style="color:#b23c15;">:</span><span style="color:#8f3f71;">0 +</span><span style="color:#282828;">keyUsage </span><span style="color:#b23c15;">=</span><span> critical</span><span style="color:#b23c15;">,</span><span> digitalSignature</span><span style="color:#b23c15;">,</span><span> cRLSign</span><span style="color:#b23c15;">,</span><span> keyCertSign +</span><span> +</span></code></pre> +<p>After, run</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">mkdir newcerts +</span><span style="color:#282828;">touch index.txt +</span><span style="color:#b57614;">echo</span><span style="color:#282828;"> 1420 </span><span style="color:#b23c15;">&gt;</span><span style="color:#282828;"> serial +</span></code></pre> +<p>We are now ready to generate keys and certificates.</p> +<h2 id="root-key-and-certificate">Root key and certificate</h2> +<p>Generate key:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">openssl genrsa -aes256 -out root_ca_key 4096 +</span></code></pre> +<p>It will ask for a passphrase, I generated mine with my KeePassXC.</p> +<p>Generate root certificate:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">openssl req -config config.conf -key root_ca_key -days 3650 -new -x509 -sha256 -extensions v3_ca -out root_ca.crt +</span></code></pre> +<p>My root CA will last for 3650 days (10 years).</p> +<p>Here's the info I provided:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>Country (2 letter code) []:FR +</span><span>State or Region []:Bretagne +</span><span>City []:Rennes +</span><span>Common Name []:philt3r CA +</span><span>Organization Name []:philt3r +</span></code></pre> +<p>I saved the <code>root_ca_key</code> and <code>root_ca.crt</code> inside my KeePassXC.</p> +<h2 id="intermediate-key-and-certificate">Intermediate key and certificate</h2> +<p>Generate key:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">openssl genrsa -aes256 -out intermediate_ca_key 4096 +</span></code></pre> +<p>It will ask for a passphrase, I generated mine with my KeePassXC.</p> +<p>Generate certificate request:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">openssl req -config config.conf -new -sha256 -key intermediate_ca_key -out intermediate_ca.csr.pem +</span></code></pre> +<p>Here's the info I provided:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>Country (2 letter code) []:FR +</span><span>State or Region []:Bretagne +</span><span>City []:Rennes +</span><span>Common Name []:philt3r Intermediate CA +</span><span>Organization Name []:philt3r +</span></code></pre> +<p>Sign certificate request with Root key:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">openssl ca -config config.conf -keyfile root_ca_key -cert root_ca.crt -extensions v3_intermediate_ca -days 1825 -notext -md sha256 -in intermediate_ca.csr.pem -out intermediate_ca.crt +</span></code></pre> +<p>My Intermediate certificate will last for 1825 days (5 years).</p> +<p>Save these files, I saved them in my KeePassXC:</p> +<ul> +<li><code>intermediate_ca_key</code></li> +<li><code>intermediate_ca.csr.pem</code></li> +<li><code>intermediate_ca.crt</code></li> +</ul> +<p>Once everything is saved and backed up, delete everything from your computer securely.</p> +<h1 id="ca-and-acme-server">CA and ACME server</h1> +<p>I discovered <a href="https://smallstep.com/">Smallstep</a>, which allows to become your own ACME server.</p> +<h2 id="install-1">Install</h2> +<p>They provide packages for Alpine, but one of them is only in the testing repos.</p> +<p>Edit</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/apk/repositories +</span></code></pre> +<p>And add:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>@testing http://mirrors.ircam.fr/pub/alpine/edge/testing +</span></code></pre> +<p>Afterwards, run</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk update +</span></code></pre> +<p>to refresh the packages.</p> +<p>Install the packages with</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add step-cli step-certificates@testing +</span></code></pre> +<p>The <code>@testing</code> is to tell <code>apk</code> to pull the package from the testing repo.</p> +<h2 id="configuration-1">Configuration</h2> +<p>Start by creating the folder where <code>step</code> will save all the configs:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">mkdir /etc/step-ca -p +</span></code></pre> +<p>Let's configure <code>step-ca</code>!</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">STEPPATH</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">/etc/step-ca </span><span style="color:#282828;">step ca init --name</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">&quot;philt3r&quot;</span><span style="color:#282828;"> --acme --address</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">&quot;10.131.111.1:444&quot;</span><span style="color:#282828;"> --provisioner</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">&quot;philt3r&quot;</span><span style="color:#282828;"> --deployment-type standalone +</span></code></pre> +<p>I ask it to run on the address <code>10.131.111.1</code> (the WireGuard ip) and on the port <code>444</code>. The port <code>443</code> will be used for a https server, so I picked 443 + 1.</p> +<p>Since I want an ACME server, I asked to get one.</p> +<p>Step will ask what IP address the clients will use to reach your ca, reply with <code>10.131.111.1</code>, because only WireGuard peers and the server should be allowed.</p> +<p>This will prompt a password, put one.</p> +<p>Step will generate a root and intermediate key, as well as an intermediate certificate. We don't want that, since we already generated our own.</p> +<p>Copy these files in <code>/etc/step-ca/certs</code>:</p> +<ul> +<li><code>root_ca.crt</code></li> +<li><code>intermediate_ca.crt</code></li> +</ul> +<p>Copy <code>intermediate_ca_key</code> in <code>/etc/step-ca/secrets</code> folder. I use the key directly, but in a safe environment use a Yubikey, but I don't have one.</p> +<h2 id="start-the-ca-acme-server">Start the CA/ACME server</h2> +<p>Run</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">step-ca /etc/step-ca/config/ca.json +</span></code></pre> +<p>to start the server. It will ask your password to decrypt the <code>intermediate_ca_key</code>. Provide the password.</p> +<p>The server should start, stop it.</p> +<p>We will now create a file containing the password of the <code>intermediate_ca_key</code>, since we want to have the ACME server starting when Alpine will boot.</p> +<p>Why put the password inside a file? Well, simply because we can't type the password at boot. Again, in an ideal environment, use a Yubikey.</p> +<p>Create a file at</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/step-ca/password.txt +</span></code></pre> +<p>and place the password inside that file.</p> +<p><code>step</code> should run as the user <code>step-ca</code>, so update the permissions on the config folder:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">chown step-ca:step-ca -Rv /etc/step-ca/ +</span></code></pre> +<p>To verify that everything worked, run:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">step-ca /etc/step-ca/config/ca.json --password-file</span><span style="color:#b23c15;">=</span><span style="color:#282828;">/etc/step-ca/password.txt +</span></code></pre> +<p>Stop the server again.</p> +<h2 id="script-to-launch-1">Script to launch</h2> +<p>Step already has a service!</p> +<ul> +<li>Start: <code>rc-service step-ca start</code></li> +<li>Stop: <code>rc-service step-ca stop</code></li> +</ul> +<h1 id="use-acme-with-caddy">Use ACME with Caddy</h1> +<p>Now let's tell Caddy to get TLS certificates with our ACME server.</p> +<p>Edit the <code>/etc/caddy/Caddyfile</code>:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span># global +</span><span>{ +</span><span> # step-ca ACME server +</span><span> acme_ca https://10.131.111.1:444/acme/acme/directory +</span><span>} +</span><span> +</span><span>intra.philt3r intra.philt3r:80 { +</span><span> root * /srv/www +</span><span> file_server browse +</span><span>} +</span></code></pre> +<p>Make sure <code>step-ca</code> is started, and restart Caddy to make sure everything is good:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">rc-service caddy restart +</span></code></pre> +<p>Now we need to tell our system to trust the certificates.</p> +<p>Download the file containing the certificates. It is available at this URL:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>https://10.131.111.1:444/roots.pem +</span></code></pre> +<p>On every device you want to trust your certificates, you will need to download the file on the device, then you will need to tell your operating system to trust it.</p> +<ul> +<li>OSX: <a href="https://tosbourn.com/getting-os-x-to-trust-self-signed-ssl-certificates/">Trust the certificate</a></li> +<li>iOS: Download the certificate from the device and <a href="https://support.apple.com/en-us/HT204477">trust it</a></li> +<li>Firefox: Install the certificate on your system and <a href="https://support.mozilla.org/en-US/kb/setting-certificate-authorities-firefox">tell firefox to trust it</a></li> +<li>Linux distros: <a href="https://ubuntu.com/server/docs/security-trust-store">Ubuntu</a>, <a href="https://docs.fedoraproject.org/en-US/quick-docs/using-shared-system-certificates">Fedora</a></li> +</ul> +<h1 id="start-on-boot">Start on boot</h1> +<p>Start <code>caddy</code> and <code>step-ca</code> on startup with:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">rc-update add step-ca +</span><span style="color:#282828;">rc-update add caddy +</span></code></pre> +<p>Reboot to make sure everything works.</p> +<h1 id="resources">Resources</h1> +<ul> +<li><a href="https://wiki.alpinelinux.org/wiki/Repositories">https://wiki.alpinelinux.org/wiki/Repositories</a></li> +<li>Awesome guide that helped me a lot: <a href="https://www.apalrd.net/posts/2023/network_acme/">https://www.apalrd.net/posts/2023/network_acme/</a></li> +</ul> + + + + + Setup CoreDNS on Alpine Linux + 2023-06-25T00:00:00+00:00 + 2023-06-25T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/coredns-alpine/ + + <p>Now that we have a WireGuard VPN, let's add a DNS server, to type letters instead of numbers!</p> +<h1 id="install-coredns">Install CoreDNS</h1> +<p>You will need to enable the <code>community</code> repo first.</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas apk add coredns +</span></code></pre> +<h1 id="configuration">Configuration</h1> +<p>Create the config in</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">/etc/coredns/Corefile +</span></code></pre> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span># snippets +</span><span>(common) { +</span><span> cache 60 +</span><span> acl { +</span><span> allow net 127.0.0.1 10.131.110.0/24 10.131.111.0/24 +</span><span> block +</span><span> } +</span><span>} +</span><span> +</span><span># intranet +</span><span>philt3r { +</span><span> import common +</span><span> log . {combined} { +</span><span> class denial error success +</span><span> } +</span><span> +</span><span> hosts { +</span><span> 10.131.111.1 intra.philt3r +</span><span> falltrough +</span><span> } +</span><span>} +</span><span> +</span><span># extranet +</span><span>. { +</span><span> import common +</span><span> +</span><span> # Free DNS +</span><span> forward . 212.27.40.240 212.27.40.241 +</span><span>} +</span></code></pre> +<p>My DNS service of choice comes from <a href="https://free.fr">free.fr</a>. Feel free to put your own favorite DNS service!</p> +<h1 id="script-to-launch-on-server-startup">Script to launch on server startup</h1> +<p>CoreDNS already has a service!</p> +<ul> +<li>Add at startup: <code>rc-update add coredns</code></li> +<li>Remove from startup: <code>rc-update del coredns</code></li> +<li>Show services at startup: <code>rc-status</code></li> +</ul> +<p>The logs of CoreDNS should be available at</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/var/log/coredns/coredns.log +</span></code></pre> +<h1 id="use-coredns-on-the-system">Use CoreDNS on the system</h1> +<p>Now that we have our DNS server, let's use it on our server!</p> +<p>If you use DHCP to get the ip address of your server, the DNS will always be used from the DHCP.</p> +<p>We want to use our own DHCP server.</p> +<p>Create the file (and the folder associated with it)</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/udhcpc/udhcpc.conf +</span></code></pre> +<p>and put</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>RESOLV_CONF=&quot;NO&quot; +</span></code></pre> +<p>Then, edit the</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/resolv.conf +</span></code></pre> +<p>and put</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>nameserver 127.0.0.1 +</span></code></pre> +<p>Restart the server.</p> + + + + + Setup WireGuard server on Alpine Linux + 2023-06-24T00:00:00+00:00 + 2023-06-24T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/wireguard-alpine/ + + <p>Let's do this baremetal, no Docker!</p> +<p>I will do this inside a <a href="https://www.proxmox.com/en/">Proxmox</a> virtual machine.</p> +<h1 id="get-started">Get started</h1> +<p>Start by installing <a href="https://www.alpinelinux.org/">Alpine Linux</a>: Run the installer, next, next, next, and boot the os once it's done.</p> +<h1 id="setup-ssh">Setup ssh</h1> +<p>Copy ssh key (run this on your local machine):</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">ssh-copy-id -i ~/.ssh/id_rsa.pub user@ip +</span></code></pre> +<p>Login via ssh, and install your favorite editor:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas apk add vim +</span></code></pre> +<p>Edit ssh config to force ssh key use:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas vim /etc/ssh/sshd_config +</span></code></pre> +<p>Find and update these statements:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>PermitRootLogin no +</span><span>PubkeyAuthentication yes +</span></code></pre> +<p>Restart ssh service, logout, and log back in</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas rc-service sshd restart +</span></code></pre> +<h1 id="setup-alpine-package-manager">Setup alpine package manager</h1> +<p>I use <code>mirrors.ircam.fr</code> as my mirror</p> +<p>Open </p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">/etc/apk/repositories +</span></code></pre> +<p>add the community repo, and run updates:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas apk -U upgrade +</span></code></pre> +<h1 id="wireguard-basics">WireGuard basics</h1> +<p>Install WireGuard:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas apk add wireguard-tools +</span></code></pre> +<h2 id="kernel-module">Kernel module</h2> +<p>Load the module</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas modprobe wireguard +</span></code></pre> +<p>To launch the module on startup, edit</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/modules +</span></code></pre> +<p>and simply add</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>wireguard +</span></code></pre> +<p>at the bottom, and save the file.</p> +<h2 id="ip-forwarding">IP forwarding</h2> +<p>Edit</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/sysctl.conf +</span></code></pre> +<p>and add</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">net.ipv4.ip_forward = 1 +</span></code></pre> +<p>at the bottom of the file, and save</p> +<p>Launch sysctl on startup with</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas rc-update add sysctl +</span></code></pre> +<p>and reboot.</p> +<h1 id="ip-addresses">IP Addresses</h1> +<p>Pick a range if ip addresses to use: <a href="https://datatracker.ietf.org/doc/html/rfc1918">RFC 1918</a></p> +<p>I'll pick <code>10.131.111.x</code> for the WireGuard peers.</p> +<p>Calculate your CIDR: <a href="https://www.ipaddressguide.com/cidr">https://www.ipaddressguide.com/cidr</a></p> +<p>Here's my network layout:</p> +<ul> +<li>CIDR: <code>10.131.110.0/23</code></li> +<li>Start: <code>10.131.110.0</code></li> +<li>End: <code>10.131.111.255</code></li> +</ul> +<p>Network services:</p> +<ul> +<li>Start: <code>10.131.110.0/24</code></li> +<li>End: <code>10.131.110.255/24</code></li> +</ul> +<p>WireGuard:</p> +<ul> +<li>Start: <code>10.131.111.0/24</code></li> +<li>End: <code>10.131.111.255/24</code></li> +</ul> +<h1 id="generate-keys-for-wireguard">Generate keys for WireGuard</h1> +<p>Do everything as root (doas is the equivalent of sudo):</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">doas su +</span></code></pre> +<p>Move to the wireguard configuration, I'll store everything there for easy access:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#b57614;">cd</span><span style="color:#282828;"> /etc/wireguard/ +</span></code></pre> +<p>Generate the private and public key, store them in files (we'll use them later):</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg genkey </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tee philt3r-privatekey </span><span style="color:#b23c15;">| </span><span style="color:#282828;">wg pubkey </span><span style="color:#b23c15;">&gt;</span><span style="color:#282828;"> philt3r-publickey +</span></code></pre> +<h1 id="configure-server-interface">Configure server interface</h1> +<p>All the server configuration will happen in</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/wireguard/wg0.conf +</span></code></pre> +<p>Protip for vim users: To add content of a file in current buffer directly: <a href="https://stackoverflow.com/a/19087947/4809297">StackOverflow answer</a></p> +<pre data-lang="ini" style="background-color:#fcf0ca;color:#282828aa;" class="language-ini "><code class="language-ini" data-lang="ini"><span style="color:#9d0006;">[Interface] +</span><span style="font-style:italic;color:#928374;"># Name = wg0 +</span><span style="color:#282828;">Address </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.111.1/24 +</span><span style="color:#282828;">ListenPort </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">51820 +</span><span style="color:#282828;">PrivateKey </span><span style="color:#b23c15;">= &lt;</span><span>server</span><span style="color:#b23c15;">-</span><span>private</span><span style="color:#b23c15;">-</span><span>key</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">PostUp </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span>t nat </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">A POSTROUTING </span><span style="color:#b23c15;">-</span><span>s </span><span style="color:#282828;">10.131.111.0/24 </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">MASQUERADE</span><span>; +</span><span style="color:#282828;">PostUp </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span>t nat </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">A POSTROUTING </span><span style="color:#b23c15;">-</span><span>s </span><span style="color:#282828;">10.131.110.0/24 </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">MASQUERADE</span><span>; +</span><span style="color:#282828;">PostUp </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">A INPUT </span><span style="color:#b23c15;">-</span><span>p udp </span><span style="color:#b23c15;">-</span><span>m udp </span><span style="color:#b23c15;">--</span><span>dport </span><span style="color:#8f3f71;">51820 </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span><span style="color:#282828;">PostUp </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">A FORWARD </span><span style="color:#b23c15;">-</span><span>i </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span><span style="color:#282828;">PostUp </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">A FORWARD </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span><span style="color:#282828;">PostDown </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span>t nat </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">D POSTROUTING </span><span style="color:#b23c15;">-</span><span>s </span><span style="color:#282828;">10.131.111.0/24 </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">MASQUERADE</span><span>; +</span><span style="color:#282828;">PostDown </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span>t nat </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">D POSTROUTING </span><span style="color:#b23c15;">-</span><span>s </span><span style="color:#282828;">10.131.110.0/24 </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">MASQUERADE</span><span>; +</span><span style="color:#282828;">PostDown </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">D INPUT </span><span style="color:#b23c15;">-</span><span>p udp </span><span style="color:#b23c15;">-</span><span>m udp </span><span style="color:#b23c15;">--</span><span>dport </span><span style="color:#8f3f71;">51820 </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span><span style="color:#282828;">PostDown </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">D FORWARD </span><span style="color:#b23c15;">-</span><span>i </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span><span style="color:#282828;">PostDown </span><span style="color:#b23c15;">=</span><span> iptables </span><span style="color:#b23c15;">-</span><span style="color:#b57614;">D FORWARD </span><span style="color:#b23c15;">-</span><span>o </span><span style="color:#9d0006;">%i </span><span style="color:#b23c15;">-</span><span>j </span><span style="color:#b57614;">ACCEPT</span><span>; +</span></code></pre> +<p>Once it's good, make sure only root can read and write to the files:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">chmod 600 /etc/wireguard/</span><span style="color:#b23c15;">* +</span></code></pre> +<h1 id="add-new-peer">Add new peer</h1> +<p>You will need to repeat this for each new peer</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#b57614;">cd</span><span style="color:#282828;"> /etc/wireguard/ +</span></code></pre> +<h2 id="generate-keys">Generate keys</h2> +<p>Starting now, <code>name</code> is a placeholder for the name of the peer.</p> +<p>I typically use the format <strong>name-of-person</strong> followed by <strong>device-name</strong>. For example, the peer for my phone will be <strong>phil-iphone</strong>.</p> +<p>Create folder to store keys for the peer:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">mkdir -p peers/name +</span></code></pre> +<p>Generate preshared key (not required):</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg genpsk </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tee peers/name/preshared.psk +</span></code></pre> +<p>Generate private and public keys for the peer:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg genkey </span><span style="color:#b23c15;">| </span><span style="color:#282828;">tee peers/name/private.key </span><span style="color:#b23c15;">| </span><span style="color:#282828;">wg pubkey </span><span style="color:#b23c15;">&gt;</span><span style="color:#282828;"> peers/name/public.key +</span></code></pre> +<h2 id="update-server-configuration">Update server configuration</h2> +<p>Edit your <code>wg0.conf</code>, add at the bottom:</p> +<pre data-lang="ini" style="background-color:#fcf0ca;color:#282828aa;" class="language-ini "><code class="language-ini" data-lang="ini"><span style="color:#9d0006;">[Peer] +</span><span style="font-style:italic;color:#928374;"># Name = name +</span><span style="color:#282828;">PublicKey </span><span style="color:#b23c15;">= &lt;</span><span>peers</span><span style="color:#b23c15;">/</span><span>name</span><span style="color:#b23c15;">/</span><span>public</span><span style="color:#b23c15;">.</span><span>key</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">PresharedKey </span><span style="color:#b23c15;">= &lt;</span><span>peers</span><span style="color:#b23c15;">/</span><span>name</span><span style="color:#b23c15;">/</span><span>preshared</span><span style="color:#b23c15;">.</span><span>psk</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">AllowedIPs </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.111.2/32 +</span><span style="color:#282828;">AllowedIPs </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.110.0/24 +</span><span style="color:#282828;">AllowedIPs </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.111.0/24 +</span></code></pre> +<h2 id="peer-configuration">Peer configuration</h2> +<p>Now let's create the configuration to give to the peer:</p> +<p>Create the file</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>peers/name/philt3r-name.wg.conf +</span></code></pre> +<p>And put the following</p> +<pre data-lang="ini" style="background-color:#fcf0ca;color:#282828aa;" class="language-ini "><code class="language-ini" data-lang="ini"><span style="color:#9d0006;">[Interface] +</span><span style="color:#282828;">PrivateKey </span><span style="color:#b23c15;">= &lt;</span><span>peers</span><span style="color:#b23c15;">/</span><span>name</span><span style="color:#b23c15;">/</span><span>private</span><span style="color:#b23c15;">.</span><span>key</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">Address </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.111.2/24 +</span><span style="font-style:italic;color:#928374;">#DNS = 10.131.111.1 +</span><span> +</span><span style="color:#9d0006;">[Peer] +</span><span style="color:#282828;">PublicKey </span><span style="color:#b23c15;">= &lt;</span><span>server</span><span style="color:#b23c15;">-</span><span>public</span><span style="color:#b23c15;">-</span><span>key</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">PresharedKey </span><span style="color:#b23c15;">= &lt;</span><span>peers</span><span style="color:#b23c15;">/</span><span>name</span><span style="color:#b23c15;">/</span><span>preshared</span><span style="color:#b23c15;">.</span><span>psk</span><span style="color:#b23c15;">&gt; +</span><span style="color:#282828;">Endpoint </span><span style="color:#b23c15;">= &lt;</span><span>server</span><span style="color:#b23c15;">-</span><span>ip</span><span style="color:#b23c15;">&gt;:</span><span style="color:#8f3f71;">51820 +</span><span style="color:#282828;">AllowedIPs </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.110.0/24 +</span><span style="color:#282828;">AllowedIPS </span><span style="color:#b23c15;">= </span><span style="color:#282828;">10.131.111.0/24 +</span><span style="color:#282828;">PersistentKeepalive </span><span style="color:#b23c15;">= </span><span style="color:#8f3f71;">25 +</span></code></pre> +<p>DNS info is not used yet, it's normal, I will enable it once my DNS server will be created (not in this blog post though).</p> +<h2 id="distribute-config">Distribute config</h2> +<p>Either give the configuration file we just created, or you can have multiple choices.</p> +<h3 id="qr-code">QR Code</h3> +<p>Start by installing</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">apk add libqrencode +</span></code></pre> +<p>And run </p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">qrencode -t ansiutf8 </span><span style="color:#b23c15;">&lt;</span><span style="color:#282828;"> peers/name/philt3r-name.wg.conf +</span></code></pre> +<h3 id="base64">Base64</h3> +<p>Note: I'm using <code>base64</code> on Alpine, which comes from BusyBox, the CLI may be different depending on the operating system you're using.</p> +<p>Encode the configuration file to a base64 string:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">cat philt3r-name.wg.conf </span><span style="color:#b23c15;">| </span><span style="color:#282828;">base64 -w 0 +</span></code></pre> +<p>And on the other device, decode the string and save to a file:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">base64 -d </span><span style="color:#b23c15;">&gt;</span><span style="color:#282828;"> philt3r-name.wg.conf +</span></code></pre> +<p>Put the base64 encoded string, and send a EOF (usually <code>ctrl + d</code>).</p> +<h2 id="restart-wireguard">Restart WireGuard</h2> +<p>If you already have WireGuard running, simply run</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>rc-service wg restart +</span></code></pre> +<p>to restart the server with your new peer.</p> +<h1 id="start-wireguard-manually">Start WireGuard manually</h1> +<p>Make sure to open the port on your router in <strong>UDP</strong> mode! I spent a lot of time debugging to realize that my port was in TCP, double check!</p> +<p>Make sure to be root before, don't use <code>doas</code> or <code>sudo</code>!</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg-quick up wg0 +</span></code></pre> +<p>On the peer, start the tunnel.</p> +<p>On the server, run</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg +</span></code></pre> +<p>to check the status of WireGuard. You should see the peer and some stats it is connected.</p> +<p>If you do not see info about the peer even if it is not connected, that means you did something wrong in the configuration!</p> +<p>From your peer, you should be able to ping the WireGuard internal IP:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>10.131.111.1 +</span></code></pre> +<ul> +<li>iOS: <a href="https://apps.apple.com/fr/app/ping-network-utility/id576773404">Ping</a></li> +<li>OSX / Linux: <code>ping</code></li> +</ul> +<p>If you can ping the ip, you're good!</p> +<p>You may not be able to go on the internet, or even make DNS requests, it's normal.</p> +<p>We are just testing if the tunnel works. You can stop the tunnel.</p> +<h1 id="stop-wireguard-manually">Stop WireGuard manually</h1> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">wg-quick down wg0 +</span></code></pre> +<h1 id="script-to-launch-on-server-startup">Script to launch on server startup</h1> +<p>To start WireGuard on startup, we will write an OpenRC script. It will be located in</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>/etc/init.d/wg +</span></code></pre> +<p>Put the following:</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="font-style:italic;color:#928374;">#!/sbin/openrc-run +</span><span style="font-style:italic;color:#928374;"># +</span><span> +</span><span style="color:#282828;">description</span><span style="color:#b23c15;">=</span><span style="color:#79740e;">&quot;WireGuard&quot; +</span><span> +</span><span style="color:#407959;">depend</span><span>() { +</span><span> </span><span style="color:#282828;">need localmount net sysctl +</span><span> </span><span style="color:#282828;">after bootmisc +</span><span>} +</span><span> +</span><span style="color:#407959;">start</span><span>() { +</span><span> </span><span style="color:#282828;">ebegin </span><span style="color:#79740e;">&quot;Starting WireGuard&quot; +</span><span> </span><span style="color:#282828;">wg-quick up wg0 +</span><span> </span><span style="color:#282828;">eend $? +</span><span>} +</span><span> +</span><span style="color:#407959;">stop</span><span>() { +</span><span> </span><span style="color:#282828;">ebegin </span><span style="color:#79740e;">&quot;Stopping WireGuard&quot; +</span><span> </span><span style="color:#282828;">wg-quick down wg0 +</span><span> </span><span style="color:#282828;">eend $? +</span><span>} +</span><span> +</span><span style="color:#407959;">status</span><span>() { +</span><span> </span><span style="color:#282828;">wg show wg0 +</span><span>} +</span></code></pre> +<p>Give it executable access</p> +<pre data-lang="sh" style="background-color:#fcf0ca;color:#282828aa;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#282828;">chmod +x /etc/init.d/wg +</span></code></pre> +<h2 id="manual">Manual</h2> +<ul> +<li>Start: <code>rc-service wg start</code></li> +<li>Stop: <code>rc-service wg stop</code></li> +<li>Restart: <code>rc-service wg restart</code></li> +<li>Status: <code>rc-service wg status</code></li> +</ul> +<h2 id="startup">Startup</h2> +<ul> +<li>Add at startup: <code>rc-update add wg</code></li> +<li>Remove from startup: <code>rc-update del wg</code></li> +<li>Show services at startup: <code>rc-status</code></li> +</ul> +<p>Reboot and make sure everything works, you should see WireGuard logs when your server is starting.</p> +<h1 id="resources">Resources</h1> +<p>These resources helped me when setting up my WireGuard server. Thanks!</p> +<ul> +<li><a href="https://github.com/pirate/wireguard-docs">https://github.com/pirate/wireguard-docs</a></li> +<li><a href="https://blog.ruanbekker.com/blog/2020/01/11/setup-a-wireguard-vpn-server-on-linux/">https://blog.ruanbekker.com/blog/2020/01/11/setup-a-wireguard-vpn-server-on-linux/</a></li> +<li><a href="https://try.popho.be/wg.html">https://try.popho.be/wg.html</a></li> +</ul> + + + + + how to use the docker of the epitech moulinette + 2020-01-19T00:00:00+00:00 + 2020-01-19T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/docker-epitech-moulinette/ + + <p>this guide will show you how to install docker, download the epitech moulinette container and learn how to use it for your projects.</p> +<h2 id="install">install</h2> +<p>ubuntu:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sudo apt install docker.io +</span></code></pre> +<p>arch:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sudo pacman -S docker +</span></code></pre> +<h2 id="setup-docker-before-first-use">setup docker before first use</h2> +<p>to use docker without root privileges run</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sudo usermod -aG docker $USER +</span></code></pre> +<p>and <strong>REBOOT</strong> your computer afterwards for changes to take effect.</p> +<p>to start docker on every boot</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sudo systemctl enable docker +</span></code></pre> +<h2 id="get-the-epitech-container">get the epitech container</h2> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>docker pull epitechcontent/epitest-docker +</span></code></pre> +<p>will download the epitech moulinette environement. make sure to have fast internet, because the container is about 5 gigabytes.</p> +<h2 id="start-the-container-and-get-a-shell">start the container and get a shell</h2> +<p>go into the directory you want to get a shell in the epitech container.</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>docker run -it --rm -v $(pwd):/home/project -w /home/project epitechcontent/epitest-docker /bin/bash +</span></code></pre> +<p>will get you a bash prompt: you are now in the container. run the commands you want, and exit the shell when you are done.</p> +<p>if you are using docker on windows (inside powershell), run</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>docker run -it --rm -v ${pwd}:/home/project -w /home/project epitechcontent/epitest-docker /bin/bash +</span></code></pre> + + + + + archlinux how old is your installation + 2019-04-18T00:00:00+00:00 + 2019-04-18T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/archlinux-how-old-is-your-installation/ + + <p>on archlinux, to see when you installed arch on your computer, run this command</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sed -n &quot;/ installed $1/{s/].*/]/p;q}&quot; /var/log/pacman.log +</span></code></pre> +<p>it will display the date and the time when you ran <code>pacstrap</code> on the live cd to install your system.</p> +<p>on my laptop, i get <strong>[2018-10-21 21:05]</strong>, which is when i switched from fedora back to arch because my school required fedora.</p> + + + + + openbsd first setup after install + 2019-03-01T00:00:00+00:00 + 2019-03-01T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/openbsd-setup/ + + <p>just installed openbsd on my chromebook, seems to be working fine!</p> +<p>since it's my first time using openbsd, here are some stuff that i will start to do on my machines after installing openbsd:</p> +<h2 id="enable-doas">enable <code>doas</code></h2> +<p><code>doas</code> is kinda the equivalent of <code>sudo</code>. to enable it, run <code>cp /etc/examples/doas.conf /etc</code> to copy the doas config file.</p> +<h2 id="disable-root-account">disable root account</h2> +<p>now that <code>doas</code> is ready, we dont need to root account anymore. to disable it, run <code>usermod -p'*' root</code> to set the root password to <code>*</code>. this will prevent root from log on directly to the machine (with <code>su</code> as an example), but with <code>doas</code> we can run <code>doas sh</code> to get a shell.</p> +<h2 id="install-missing-firmware-for-your-hardware">install missing firmware for your hardware</h2> +<p>maybe your wifi card isn't working? or maybe you can't display any graphical interface? maybe that's because you don't have the firmware for it: here's how to install it:</p> +<p>run <code>doas fw_update -i</code> to see the missing firmwares.</p> +<p>so grab a flash drive, format it in <em>fat</em> filesystem format, go to <a href="http://firmware.openbsd.org/firmware/">firmware.openbsd.org</a>, download the missing firmwares, along with the <strong>SHA256.sig</strong> and <strong>index.txt</strong> files, and put them on the usb key.</p> +<p>mount the flash drive on openbsd, and run <code>doas fw_update -p *path of flash drive*</code> to install the firmwares from the flash drive.</p> +<p>your missing firmware should not be anymore.</p> + + + + + how to put a custom boot logo on a thinkpad + 2019-02-24T00:00:00+00:00 + 2019-02-24T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/thinkpad-custom-boot-logo/ + + <h2 id="disclaimer">disclaimer</h2> +<p>i need to warn you that you are on your own. even though it works fine, i'm not responsible of what you do.</p> +<h2 id="introduction">introduction</h2> +<p>you have a thinkpad. it's beautiful, it's fast, it's perfect, it doesn't run windows; there's just one thing that could be perfect: the boot logo.</p> +<p>by default on new models, your boot logo look like this:</p> +<p><img src="https://blog.x4m3.rocks/thinkpad-custom-boot-logo/default-logo.jpg" alt="" /></p> +<p>to get a custom boot logo, you need:</p> +<ul> +<li>an internet connection</li> +<li>a compatible model</li> +<li>a usb flash drive</li> +<li>a gif image (you can also use a <em>bmp</em> or a <em>jpg</em> image, but i've found that with <em>gif</em> images it works better)</li> +</ul> +<h2 id="get-the-bios-update">get the BIOS update</h2> +<p>to install your custom boot logo, you need to flash a BIOS update.</p> +<p>to download the BIOS update, go on <a href="https://pcsupport.lenovo.com/us/en">lenovo's support website</a>, choose <strong>drivers and updates</strong> and find your model.</p> +<p>next, go in the section <strong>BIOS/UEFI</strong> and download the <strong>BIOS Update (Bootable CD)</strong>. it will download a <em>iso</em> image.</p> +<p>if you can't find the update image, that means that you're out of luck, and you can't get a custom boot logo. sorry.</p> +<h2 id="convert-the-iso-image">convert the iso image</h2> +<p>now that you have the iso image, you need to convert it to a <em>img</em> file. to do so, run the following command in a terminal:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>geteltorito -o bios-image.img bios-image-downloaded.iso +</span></code></pre> +<p>if you don't have <strong>geteltorito</strong>, look online to install it.</p> +<h2 id="flash-the-image-on-your-usb-drive">flash the image on your usb drive</h2> +<p>now it's time to flash the image on your usb drive. get the name of your flash drive using <code>lsblk</code>, plug your usb drive, and run <code>lsblk</code> again to see your drive.</p> +<p>go into the folder where the <em>img</em> file is located, and run in a terminal:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>sudo dd if=bios-image.img of=/dev/sdX bs=1M status=progress oflag=sync +</span></code></pre> +<p>where <strong>X</strong> is your drive letter that you know thanks to <code>lsblk</code>.</p> +<h2 id="get-the-gif-file-to-use">get the <em>gif</em> file to use</h2> +<p>if you want, i already have this selection of images ready to be used, or you can make your own!</p> +<div> + + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;thinkpad1.147b5c16ea6432da.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;apple-rainbow.dae843aec90e4fd2.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/puffy.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;puffy.00aa29dd6b99e171.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/vim.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;vim.aed1174ef81696b6.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/archlinux.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;archlinux.456d8134dea984ad.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/nsa.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;nsa.881fde7a73711187.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/epitech.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;epitech.2fb0f9976e9b5a67.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/pornhub.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;pornhub.66a33fa0ddb7d786.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;thinkpad2.d689f4141765e8ee.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/darth-vader.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;darth-vader.8707e38ea58ce5b9.jpg" /> + </a> + <a href="https://blog.x4m3.rocks/2019-02-24-thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif" target="_blank"> + <img src="https:&#x2F;&#x2F;blog.x4m3.rocks&#x2F;processed_images&#x2F;tux-verry-small.9bd45f15396c7ffa.jpg" /> + </a> +</div> +<p>you can see the requirements, go in your usb drive, open the <strong>readme.txt</strong> in the <em>flash</em> folder.</p> +<p>put the <em>gif</em> image in the <em>flash</em> folder, and name it <strong>LOGO1.JPG</strong>. copy that image, and name that one <strong>LOGO2.JPG</strong>.</p> +<p>check the <strong>readme.txt</strong> file to see the filenames, they might differ on different models.</p> +<h2 id="flash-the-bios-update">flash the BIOS update</h2> +<p>reboot your computer, and boot on the usb flash drive. if you don't know how, the internet should help you with that.</p> +<p>now that the flash utility has booted, choose the second option, and follow the instructions.</p> +<p>the computer will reboot, flash the update, and when it will reboot, you should get your custom boot logo!</p> +<p><img src="https://blog.x4m3.rocks/thinkpad-custom-boot-logo/custom-logo.jpg" alt="" /></p> +<p>if you want to go back to the default logo, simply reflash the bios update, when when asked if you want to use your custom logo, say no, and the default logo will be put back.</p> + + + + + my contributions to the linux kernel + 2018-04-10T00:00:00+00:00 + 2018-04-10T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/linux-kernel-contributions/ + + <p>you read it right! i am a contributor to the linux kernel!</p> +<p>... but you are going to be dissapointed: my contributions are not going to change the world, just comments, alignments and documentation and stuff...</p> +<p>i submited something like 10 patches (as of april 10, 2018) and 3 patches have been accepted and are now into the kernel!</p> +<p>if you wanna check them out, you can read them on <a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/?qt=author&amp;q=Philippe+Loctaux">kernel.org</a>.</p> +<p>yes, i am aware that Linus has a copy of the repo on github, but when <a href="https://github.com/torvalds/linux/commits?author=x4m3">i try to see my commits on github</a>, i can't get them because there is too many commits and github can't get me the list.</p> +<p>so, here are my kernel contributions, listed by date:</p> +<ul> +<li><a href="https://github.com/torvalds/linux/commit/81c18a9e378c87ed6559a4b0a0c2831c88947373">feb 23, 2016</a></li> +<li><a href="https://github.com/torvalds/linux/commit/ce6550818280c1e7caae727d2b9504140b6370f0">mar 7, 2016</a></li> +<li><a href="https://github.com/torvalds/linux/commit/9d4c0c9f6a747a9bdec03057be4193994839ec87">dec 28, 2017</a></li> +</ul> + + + + + restart chrome with a url + 2018-04-09T00:00:00+00:00 + 2018-04-09T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/restart-chrome-url/ + + <p>did you know that you can restart chrome/chromium with a simple url?</p> +<p>here is it: <a href="about://restart">about://restart</a> !</p> +<p>but this trick does not work with the <code>&lt;a&gt;</code> html tag, which seems logical, copy the link and paste it in a new tab to get it to work</p> +<p>it'd be annoying as fuck if you could click on links that restart your browser, imagine if an extension could replace every clickable link with this one! 😊</p> +<p>i think its usage is for chrome developers, the end user doesn't really care to type a url to restart their browser, they click on the <code>x</code> and they reopen it (duh).</p> + + + + + error on zsh when using vim and autocomplete + 2018-03-13T00:00:00+00:00 + 2018-03-13T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/zsh-vim-autocomplete-error/ + + <p>do you use <strong>zsh</strong> and <strong>ohmyzsh</strong> ?</p> +<p>do you run into an issue when you are about to edit a file with vim, and you use the <strong>Tab</strong> key to autocomplete the filename, but instead you get something like this:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>$ vim ~/filena&lt;TAB&gt; +</span><span>_arguments:448: _vim_files: function definition file not found +</span></code></pre> +<p>annoying af, right ?</p> +<h2 id="how-to-fix-it">how to fix it</h2> +<p>here's how to fix it: delete the zcompdump directory off your personal directory, and reload your zsh config file (or close and open a new shell).</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>rm -rf ~/.zcompdump*; source ~/.zshrc; +</span></code></pre> +<p>it took me at least 15 mins to find that .... hopefully i save some time for you .</p> +<h3 id="sources">sources</h3> +<p><a href="https://unix.stackexchange.com/questions/280622/zsh-fails-at-path-completition-when-command-is-vim#280626">stackoverflow</a> and <a href="https://github.com/robbyrussell/oh-my-zsh/issues/518">github</a></p> + + + + + how to link your vimrc file on windows + 2018-02-17T00:00:00+00:00 + 2018-02-17T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/link-your-vimrc-file-on-windows/ + + <p>i code on my linux machine, and i use vim as my text editor.<br /> +i've been using vim for almost 4 years, and i started to make my config file.<br /> +i store it with git, along all my config files for my linux setup (aka my dot files).</p> +<p>here's the thing, i also use windows to code, and i also use vim.<br /> +i also want to use the same config that i store in git.</p> +<p>to do so i need to do a symbolink link to my vimrc file. i dunno how to do that on windows.</p> +<p>here's how to do it:</p> +<h2 id="cmd">cmd</h2> +<p>if you use the old school, black boxed <strong>cmd.exe</strong>, you need to run these commands:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>cd c:\users\_username_ +</span><span>mklink .vimrc _path-to-vimrc_ +</span></code></pre> +<p>and you should be good to go.<br /> +just make sure it has been linked correctly with <code>vim ~/.vimrc</code></p> +<h2 id="powershell">powershell</h2> +<p>if you use the new, blue boxed <strong>powershell.exe</strong>, it's a bit different:<br /> +you can make it with powershell's language (or whatever they call the stuff they're using), but some require admin privileges, some require custom functions or something like that...</p> +<p>or you can keep it simple and use the <strong>cmd</strong> command to use <strong>cmd.exe</strong> to run the <strong>mklink</strong> program to make the symlink:</p> +<pre data-lang="powershell" style="background-color:#fcf0ca;color:#282828aa;" class="language-powershell "><code class="language-powershell" data-lang="powershell"><span>cd c:\users\_username_ +</span><span>cmd </span><span style="color:#b23c15;">/</span><span>c mklink .vimrc _path</span><span style="color:#b23c15;">-</span><span>to</span><span style="color:#b23c15;">-</span><span>vimrc_ +</span></code></pre> +<h2 id="sources">sources</h2> +<p>i found <a href="http://saadware.com/windows-vimrc-link/">this blog post</a> to find out how to do symlinks on cmd,<br /> +and i used <a href="https://en.wikipedia.org/wiki/NTFS_symbolic_link#Tools">this wikipedia article</a> and <a href="https://stackoverflow.com/a/5549583">this stackoverflow thread</a> to learn how to do it on powershell.</p> + + + + + dd status + 2016-07-14T00:00:00+00:00 + 2016-07-14T00:00:00+00:00 + + Unknown + + + https://blog.x4m3.rocks/dd-status/ + + <p>Here's a cool tip if you use dd to copy disk images to a disk, or if you want to clone drives.</p> +<p>As we all know (or should know), dd is a powerful tool; but it can be dangerous if not manipulated correctly.</p> +<p>By default, dd doesn't give any information on what is it doing; which can be very boring, because you don't know when you'll be able to test that new Linux distro you just discovered!</p> +<p>Well, good news! You can get some status from dd! This tip works on Linux and OS X.</p> +<h2 id="linux">Linux</h2> +<p>When you enter your <code>dd</code> command, add this little snippet at the end:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>status=progress +</span></code></pre> +<p>When dd will be busy doing its thing, you should get some info about its progress.</p> +<h2 id="os-x">OS X</h2> +<p>Run your dd command normally without <code>status=progress</code>, after that open a new terminal and enter this command:</p> +<pre style="background-color:#fcf0ca;color:#282828aa;"><code><span>while pgrep ^dd; do sudo pkill -INFO dd; sleep 30; done; +</span></code></pre> +<p>And come back into the dd command. When the dd task will be done, the second command we ran will exit as well and you can close that other terminal safely.</p> +<p><code>30</code> is the number of seconds that will update the counter every X seconds.</p> + + + + diff --git a/browserconfig.xml b/browserconfig.xml new file mode 100644 index 0000000..b3930d0 --- /dev/null +++ b/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/caddy-ca-acme-alpine/index.html b/caddy-ca-acme-alpine/index.html new file mode 100644 index 0000000..41e97fb --- /dev/null +++ b/caddy-ca-acme-alpine/index.html @@ -0,0 +1,355 @@ + + + + + + + + Setup Caddy with a CA and ACME server on Alpine Linux · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Setup Caddy with a CA and ACME server on Alpine Linux

+ + +

Posted on

+ + +

Now that we have a WireGuard VPN with an awesome internal DNS server, let's get a web server with HTTPS!

+

Caddy

+

Install

+

You will need to enable the community repo first.

+
doas apk add caddy
+
+

Configuration

+

Create a folder to serve stuff from, I placed it in

+
/srv/www
+
+

Create the config in

+
/etc/caddy/Caddyfile
+
+

Here's the config, it's very simple to get started:

+
intra.philt3r:80
+root * /srv/www
+file_server browse
+
+

This config will only launch an HTTP server, the HTTPS will come later.

+

It should work only from the WireGuard peers, since they can resolve the DNS name intra.philt3r.

+

If there is no index.html in the folder, it will serve static files directly.

+

Script to launch

+

Caddy already has a service!

+ +

Generate keys and certificates

+

We will generate the Root CA, the Intermediate CA.

+

Generate these with openssl installed on a computer, preferabbly offline.

+

Make sure the keys are stored in a safe place, I will store mine inside of a KeePassXC keystore.

+

OpenSSL Configuration

+

inside a folder, create a file

+
config.conf
+
+

In [CA_root], make sure to put your folder dir

+
# OpenSSL root CA configuration file.
+
+[ ca ]
+# `man ca`
+default_ca = CA_root
+
+[ CA_root ]
+# Directory and file locations.
+dir               = /home/phil/ca
+certs             = $dir/certs
+crl_dir           = $dir/crl
+new_certs_dir     = $dir/newcerts
+database          = $dir/index.txt
+serial            = $dir/serial
+RANDFILE          = $dir/private/.rand
+
+# The root key and root certificate.
+# Match names with Smallstep naming convention
+private_key       = $dir/root_ca_key
+certificate       = $dir/root_ca.crt
+
+# For certificate revocation lists.
+crlnumber         = $dir/crlnumber
+crl               = $dir/crl/ca.crl.pem
+crl_extensions    = crl_ext
+default_crl_days  = 30
+
+# SHA-1 is deprecated, so use SHA-2 instead.
+default_md        = sha256
+
+name_opt          = ca_default
+cert_opt          = ca_default
+default_days      = 25202
+preserve          = no
+policy            = policy_strict
+
+[ policy_strict ]
+# The root CA should only sign intermediate certificates that match.
+# See the POLICY FORMAT section of `man ca`.
+countryName             = match
+stateOrProvinceName 	= supplied
+localityName	    	= supplied
+organizationName        = match
+commonName              = supplied
+
+[ req ]
+# Options for the `req` tool (`man req`).
+default_bits        = 4096
+distinguished_name  = req_distinguished_name
+string_mask         = utf8only
+
+# SHA-1 is deprecated, so use SHA-2 instead.
+default_md          = sha256
+
+# Extension to add when the -x509 option is used.
+x509_extensions     = v3_ca
+
+[ req_distinguished_name ]
+# See <https://en.wikipedia.org/wiki/Certificate_signing_request>.
+countryName          = Country (2 letter code)
+stateOrProvinceName  = State or Region
+localityName         = City
+commonName           = Common Name
+0.organizationName   = Organization Name
+
+[ v3_ca ]
+# Extensions for a typical CA (`man x509v3_config`).
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid:always,issuer
+basicConstraints = critical, CA:true
+keyUsage = critical, digitalSignature, cRLSign, keyCertSign
+
+[ v3_intermediate_ca ]
+# Extensions for a typical intermediate CA (`man x509v3_config`).
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid:always,issuer
+basicConstraints = critical, CA:true, pathlen:0
+keyUsage = critical, digitalSignature, cRLSign, keyCertSign
+
+
+

After, run

+
mkdir newcerts
+touch index.txt
+echo 1420 > serial
+
+

We are now ready to generate keys and certificates.

+

Root key and certificate

+

Generate key:

+
openssl genrsa -aes256 -out root_ca_key 4096
+
+

It will ask for a passphrase, I generated mine with my KeePassXC.

+

Generate root certificate:

+
openssl req -config config.conf -key root_ca_key -days 3650 -new -x509 -sha256 -extensions v3_ca -out root_ca.crt
+
+

My root CA will last for 3650 days (10 years).

+

Here's the info I provided:

+
Country (2 letter code) []:FR
+State or Region []:Bretagne
+City []:Rennes
+Common Name []:philt3r CA
+Organization Name []:philt3r
+
+

I saved the root_ca_key and root_ca.crt inside my KeePassXC.

+

Intermediate key and certificate

+

Generate key:

+
openssl genrsa -aes256 -out intermediate_ca_key 4096
+
+

It will ask for a passphrase, I generated mine with my KeePassXC.

+

Generate certificate request:

+
openssl req -config config.conf -new -sha256 -key intermediate_ca_key -out intermediate_ca.csr.pem
+
+

Here's the info I provided:

+
Country (2 letter code) []:FR
+State or Region []:Bretagne
+City []:Rennes
+Common Name []:philt3r Intermediate CA 
+Organization Name []:philt3r
+
+

Sign certificate request with Root key:

+
openssl ca -config config.conf -keyfile root_ca_key -cert root_ca.crt -extensions v3_intermediate_ca -days 1825 -notext -md sha256 -in intermediate_ca.csr.pem -out intermediate_ca.crt
+
+

My Intermediate certificate will last for 1825 days (5 years).

+

Save these files, I saved them in my KeePassXC:

+ +

Once everything is saved and backed up, delete everything from your computer securely.

+

CA and ACME server

+

I discovered Smallstep, which allows to become your own ACME server.

+

Install

+

They provide packages for Alpine, but one of them is only in the testing repos.

+

Edit

+
/etc/apk/repositories
+
+

And add:

+
@testing http://mirrors.ircam.fr/pub/alpine/edge/testing
+
+

Afterwards, run

+
apk update
+
+

to refresh the packages.

+

Install the packages with

+
apk add step-cli step-certificates@testing
+
+

The @testing is to tell apk to pull the package from the testing repo.

+

Configuration

+

Start by creating the folder where step will save all the configs:

+
mkdir /etc/step-ca -p
+
+

Let's configure step-ca!

+
STEPPATH=/etc/step-ca step ca init --name="philt3r" --acme --address="10.131.111.1:444" --provisioner="philt3r" --deployment-type standalone
+
+

I ask it to run on the address 10.131.111.1 (the WireGuard ip) and on the port 444. The port 443 will be used for a https server, so I picked 443 + 1.

+

Since I want an ACME server, I asked to get one.

+

Step will ask what IP address the clients will use to reach your ca, reply with 10.131.111.1, because only WireGuard peers and the server should be allowed.

+

This will prompt a password, put one.

+

Step will generate a root and intermediate key, as well as an intermediate certificate. We don't want that, since we already generated our own.

+

Copy these files in /etc/step-ca/certs:

+ +

Copy intermediate_ca_key in /etc/step-ca/secrets folder. I use the key directly, but in a safe environment use a Yubikey, but I don't have one.

+

Start the CA/ACME server

+

Run

+
step-ca /etc/step-ca/config/ca.json
+
+

to start the server. It will ask your password to decrypt the intermediate_ca_key. Provide the password.

+

The server should start, stop it.

+

We will now create a file containing the password of the intermediate_ca_key, since we want to have the ACME server starting when Alpine will boot.

+

Why put the password inside a file? Well, simply because we can't type the password at boot. Again, in an ideal environment, use a Yubikey.

+

Create a file at

+
/etc/step-ca/password.txt
+
+

and place the password inside that file.

+

step should run as the user step-ca, so update the permissions on the config folder:

+
chown step-ca:step-ca -Rv /etc/step-ca/
+
+

To verify that everything worked, run:

+
step-ca /etc/step-ca/config/ca.json --password-file=/etc/step-ca/password.txt
+
+

Stop the server again.

+

Script to launch

+

Step already has a service!

+ +

Use ACME with Caddy

+

Now let's tell Caddy to get TLS certificates with our ACME server.

+

Edit the /etc/caddy/Caddyfile:

+
# global
+{
+        # step-ca ACME server
+        acme_ca https://10.131.111.1:444/acme/acme/directory
+}
+
+intra.philt3r intra.philt3r:80 {
+        root * /srv/www
+        file_server browse
+}
+
+

Make sure step-ca is started, and restart Caddy to make sure everything is good:

+
rc-service caddy restart
+
+

Now we need to tell our system to trust the certificates.

+

Download the file containing the certificates. It is available at this URL:

+
https://10.131.111.1:444/roots.pem
+
+

On every device you want to trust your certificates, you will need to download the file on the device, then you will need to tell your operating system to trust it.

+ +

Start on boot

+

Start caddy and step-ca on startup with:

+
rc-update add step-ca
+rc-update add caddy
+
+

Reboot to make sure everything works.

+

Resources

+ + +
+ + + + + + +
+ + + + + diff --git a/coredns-alpine/index.html b/coredns-alpine/index.html new file mode 100644 index 0000000..d2c1c82 --- /dev/null +++ b/coredns-alpine/index.html @@ -0,0 +1,156 @@ + + + + + + + + Setup CoreDNS on Alpine Linux · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Setup CoreDNS on Alpine Linux

+ + +

Posted on

+ + +

Now that we have a WireGuard VPN, let's add a DNS server, to type letters instead of numbers!

+

Install CoreDNS

+

You will need to enable the community repo first.

+
doas apk add coredns
+
+

Configuration

+

Create the config in

+
/etc/coredns/Corefile
+
+
# snippets
+(common) {
+    cache 60
+    acl {
+        allow net 127.0.0.1 10.131.110.0/24 10.131.111.0/24
+        block
+    }
+}
+
+# intranet
+philt3r {
+    import common
+    log . {combined} {
+        class denial error success
+    }
+
+    hosts {
+        10.131.111.1 intra.philt3r
+        falltrough
+    }
+}
+
+# extranet
+. {
+    import common
+
+    # Free DNS
+    forward . 212.27.40.240 212.27.40.241
+}
+
+

My DNS service of choice comes from free.fr. Feel free to put your own favorite DNS service!

+

Script to launch on server startup

+

CoreDNS already has a service!

+ +

The logs of CoreDNS should be available at

+
/var/log/coredns/coredns.log
+
+

Use CoreDNS on the system

+

Now that we have our DNS server, let's use it on our server!

+

If you use DHCP to get the ip address of your server, the DNS will always be used from the DHCP.

+

We want to use our own DHCP server.

+

Create the file (and the folder associated with it)

+
/etc/udhcpc/udhcpc.conf
+
+

and put

+
RESOLV_CONF="NO"
+
+

Then, edit the

+
/etc/resolv.conf
+
+

and put

+
nameserver 127.0.0.1
+
+

Restart the server.

+ +
+ + + + + + +
+ + + + + diff --git a/dd-status/index.html b/dd-status/index.html new file mode 100644 index 0000000..bfbca7a --- /dev/null +++ b/dd-status/index.html @@ -0,0 +1,104 @@ + + + + + + + + dd status · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

dd status

+ + +

Posted on

+ + +

Here's a cool tip if you use dd to copy disk images to a disk, or if you want to clone drives.

+

As we all know (or should know), dd is a powerful tool; but it can be dangerous if not manipulated correctly.

+

By default, dd doesn't give any information on what is it doing; which can be very boring, because you don't know when you'll be able to test that new Linux distro you just discovered!

+

Well, good news! You can get some status from dd! This tip works on Linux and OS X.

+

Linux

+

When you enter your dd command, add this little snippet at the end:

+
status=progress
+
+

When dd will be busy doing its thing, you should get some info about its progress.

+

OS X

+

Run your dd command normally without status=progress, after that open a new terminal and enter this command:

+
while pgrep ^dd; do sudo pkill -INFO dd; sleep 30; done;
+
+

And come back into the dd command. When the dd task will be done, the second command we ran will exit as well and you can close that other terminal safely.

+

30 is the number of seconds that will update the counter every X seconds.

+ +
+ + + + + + +
+ + + + + diff --git a/docker-epitech-moulinette/index.html b/docker-epitech-moulinette/index.html new file mode 100644 index 0000000..dd89158 --- /dev/null +++ b/docker-epitech-moulinette/index.html @@ -0,0 +1,117 @@ + + + + + + + + how to use the docker of the epitech moulinette · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

how to use the docker of the epitech moulinette

+ + +

Posted on

+ + +

this guide will show you how to install docker, download the epitech moulinette container and learn how to use it for your projects.

+

install

+

ubuntu:

+
sudo apt install docker.io
+
+

arch:

+
sudo pacman -S docker
+
+

setup docker before first use

+

to use docker without root privileges run

+
sudo usermod -aG docker $USER
+
+

and REBOOT your computer afterwards for changes to take effect.

+

to start docker on every boot

+
sudo systemctl enable docker
+
+

get the epitech container

+
docker pull epitechcontent/epitest-docker
+
+

will download the epitech moulinette environement. make sure to have fast internet, because the container is about 5 gigabytes.

+

start the container and get a shell

+

go into the directory you want to get a shell in the epitech container.

+
docker run -it --rm -v $(pwd):/home/project -w /home/project epitechcontent/epitest-docker /bin/bash
+
+

will get you a bash prompt: you are now in the container. run the commands you want, and exit the shell when you are done.

+

if you are using docker on windows (inside powershell), run

+
docker run -it --rm -v ${pwd}:/home/project -w /home/project epitechcontent/epitest-docker /bin/bash
+
+ +
+ + + + + + +
+ + + + + diff --git a/docker-private-registry/index.html b/docker-private-registry/index.html new file mode 100644 index 0000000..be6dbf1 --- /dev/null +++ b/docker-private-registry/index.html @@ -0,0 +1,258 @@ + + + + + + + + Setup a private Docker registry · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Setup a private Docker registry

+ + +

Posted on

+ + +

My internal infrastructure is complete. I can now work on my projects, but at some point they need to go out to the world!

+

The platform for most of my projects is the web, and the best tool I found so far to deploy them is Docker.

+

I want to keep the code on the private infrastructure, but I also want to be in control of where the docker images will be stored.

+

The perfect solution is a private Docker registry! But it will not be on the internal infrastructure, it will be publicly available on a regular server.

+

That way, projects can be deployed in their final form whenever and wherever, while the source remaining private.

+

Get started locally

+

To start, I will launch a test registry on my machine to make sure everything works.

+

I will use these docker images:

+ +

Here's the docker-compose file I used to get started:

+
services:
+
+  registry-server:
+    image: registry:2.8.2
+    ports:
+      - 5000:5000
+    volumes:
+      - ./registry-data:/var/lib/registry
+      - ./passwords:/auth/htpasswd
+    environment:
+      REGISTRY_AUTH: 'htpasswd'
+      REGISTRY_AUTH_HTPASSWD_REALM: 'Registry Realm'
+      REGISTRY_AUTH_HTPASSWD_PATH: '/auth/htpasswd'
+      REGISTRY_HTTP_HEADERS_Access-Control-Origin: '[http://registry.example.com]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Credentials: '[true]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
+      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
+    container_name: registry-server
+
+  registry-ui:
+    image: joxit/docker-registry-ui:2.5.0
+    ports:
+      - 8001:80
+    environment:
+      SINGLE_REGISTRY: true
+      REGISTRY_TITLE: Docker Registry UI
+      DELETE_IMAGES: true
+      SHOW_CONTENT_DIGEST: true
+      NGINX_PROXY_PASS_URL: http://registry-server:5000
+      SHOW_CATALOG_NB_TAGS: true
+      CATALOG_MIN_BRANCHES: 1
+      CATALOG_MAX_BRANCHES: 1
+      TAGLIST_PAGE_SIZE: 100
+      REGISTRY_SECURED: false
+      CATALOG_ELEMENTS_LIMIT: 1000
+    container_name: registry-ui
+
+

But don't start the services right away.

+

Authentication

+

I don't want the registry being open to everyone though, let's add some authentication.

+

To keep things simple, I will use HTTP basic auth. If you want, there's a possibility to have a more complex setup.

+

Here's a quick script to get passwords in a format that Docker will accept:

+
#!/bin/sh
+#
+# new-password.sh
+
+if [ -z "$1" ]
+then
+echo "usage: $0 username"
+exit 1
+fi
+
+echo "creating password for user \"$1\""
+htpasswd -nB $1
+
+

How to use it:

+
$ ./new-password.sh phil
+creating password for user "phil"
+New password: phil
+Re-type new password: phil
+phil:$2y$05$asxsqfmEQJpg8zuKGyieMOmTirok.Gd/noliF.y48DJXe.97ufGHG
+
+

Copy the last line in the passwords file (see the docker-compose file).

+

Repeat the process for every user you want to give authentication to your registry.

+

Keep in mind I only cover AUTHENTICATION (who can access the registry), and not AUTHORIZATION (who can do what on the registry). With this setup, if you have access to the registry, you can do anything on it.

+

Use the registry

+

Start the services with

+
docker compose up
+
+

Now, you can access the webui by going to

+
http://localhost:8001
+
+

in a web browser and sign-in with your credentials. You should see an empty list. Let's add some images!

+

Naming images

+

Pick an image you want on the registry.

+

If it's an existing image:

+
docker tag name-of-existing-image localhost:5000/existing-image-name
+
+

If you build the image directly:

+
docker build -t localhost:5000/new-image-name
+
+

The name of the image must have the domain of the registry, in our case it's localhost:5000.

+

Login to registry

+

To sign in to the registry, use

+
docker login localhost:5000
+
+

and enter your credentials.

+

Push / Pull

+

Simply run the usual docker command to push or pull images. Docker will know which registry to use based of the image's name.

+
docker push localhost:5000/new-image-name
+docker pull localhost:5000/existing-image-name
+
+

That's pretty much it!

+

Deploy to production

+

I use Caprover to deploy my docker images easily, it comes with a reverse proxy and automatic TLS certificates with Let's encrypt.

+

Here's the one-click-app config I created for the registry:

+
captainVersion: 4
+
+services:
+  $$cap_appname-registry:
+    image: registry:$$cap_registry_version
+    volumes:
+      - $$cap_appname-data:/var/lib/registry
+      - $$cap_appname-auth:/auth/
+    environment:
+      REGISTRY_AUTH: 'htpasswd'
+      REGISTRY_AUTH_HTPASSWD_REALM: 'Registry Realm'
+      REGISTRY_AUTH_HTPASSWD_PATH: '/auth/htpasswd'
+      REGISTRY_HTTP_HEADERS_Access-Control-Origin: '[https://$$cap_appname-registry.$$cap_root_domain, https://$$cap_appname-ui.$$cap_root_domain]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Credentials: '[true]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
+      REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
+      REGISTRY_STORAGE_DELETE_ENABLED: 'true'
+    caproverExtra:
+        containerHttpPort: '5000'
+
+  $$cap_appname-ui:
+    image: joxit/docker-registry-ui:$$cap_ui_version
+    environment:
+      SINGLE_REGISTRY: true
+      REGISTRY_TITLE: Docker Registry UI
+      DELETE_IMAGES: true
+      SHOW_CONTENT_DIGEST: true
+      NGINX_PROXY_PASS_URL: http://srv-captain--$$cap_appname-registry:5000
+      SHOW_CATALOG_NB_TAGS: true
+      CATALOG_MIN_BRANCHES: 1
+      CATALOG_MAX_BRANCHES: 1
+      TAGLIST_PAGE_SIZE: 100
+      REGISTRY_SECURED: false
+      CATALOG_ELEMENTS_LIMIT: 1000
+
+caproverOneClickApp:
+    variables:
+        - id: '$$cap_registry_version'
+          label: Registry Version
+          defaultValue: '2.8.2'
+          description: Check out the Docker page for the valid tags https://hub.docker.com/_/registry/tags
+          validRegex: "/.{1,}/"
+        - id: '$$cap_ui_version'
+          label: UI Version
+          defaultValue: '2.5.0'
+          description: Check out the Docker page for the valid tags https://hub.docker.com/r/joxit/docker-registry-ui/tags
+          validRegex: "/.{1,}/"
+    instructions:
+        start: |-
+            A private docker registry, with a webui to see images
+        end: |-
+            The registry has been deployed! Look in the "auth" volume to update credentials
+    displayName: docker-registry-with-ui
+    isOfficial: false
+    description: A private docker registry, with a webui to see images
+    documentation: https://docs.docker.com/registry/
+
+ +
+ + + + + + +
+ + + + + diff --git a/dynamic-motd-alpine/index.html b/dynamic-motd-alpine/index.html new file mode 100644 index 0000000..cd5ae90 --- /dev/null +++ b/dynamic-motd-alpine/index.html @@ -0,0 +1,172 @@ + + + + + + + + Dynamic MOTD on Alpine Linux · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Dynamic MOTD on Alpine Linux

+ + +

Posted on

+ + +

When we sign in to our server, the message of the day (MOTD) is pretty lame. Let's get something better!

+

This is the default MOTD of alpine:

+
Welcome to Alpine!
+
+The Alpine Wiki contains a large amount of how-to guides and general
+information about administrating Alpine systems.
+See <http://wiki.alpinelinux.org>.
+
+You can setup the system with the command: setup-alpine
+
+You may change this message by editing /etc/motd.
+
+

And here's my new MOTD. I even show the WireGuard ip address:

+

+
+  Name: intra.philt3r
+  Kernel: 6.1.35-0-lts
+  Distro: Alpine Linux v3.18
+  Version 3.18.2
+
+  Uptime: 0 days, 0 hours, 22 minutes
+  CPU Load: 0.00, 0.00, 0.00
+
+  Memory: 468M
+  Free Memory: 217M
+
+  Disk: 6.6G
+  Free Disk: 6.6G
+
+  eth0 Address: 192.168.1.71
+  wg0 Address: 10.131.111.1
+
+
+
+

Start and enable cron at startup (it should be installed by default):

+
rc-service crond start
+rc-update add crond
+
+

Let's run a script every 15 minutes to update the /etc/motd file:

+
/etc/periodic/15min/motd
+
+

Here's the content of my MOTD:

+
#!/bin/sh
+#. /etc/os-release
+PRETTY_NAME=`awk -F= '$1=="PRETTY_NAME" { print $2 ;}' /etc/os-release | tr -d '"'`
+VERSION_ID=`awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release`
+UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
+UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
+UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
+cat > /etc/motd << EOF
+
+
+  Name: `hostname`
+  Kernel: `uname -r`
+  Distro: $PRETTY_NAME
+  Version $VERSION_ID
+
+  Uptime: $UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes
+  CPU Load: `cat /proc/loadavg | awk '{print $1 ", " $2 ", " $3}'`
+
+  Memory: `free -m | head -n 2 | tail -n 1 | awk {'print  $2'}`M
+  Free Memory: `free -m | head -n 2 | tail -n 1 | awk {'print $4'}`M
+
+  Disk: `df -h / | awk  '{ a = $2 } END { print a }'`
+  Free Disk: `df -h / | awk '{ a =  $2 } END { print a }'`
+
+  eth0 Address: `ifconfig eth0 | grep "inet addr" |  awk -F: '{print $2}' | awk '{print $1}'`
+  wg0 Address: `ifconfig wg0 | grep "inet addr" |  awk -F: '{print $2}' | awk '{print $1}'`
+
+
+EOF
+
+

Make the script executable, and check if it's good:

+
chmod a+x /etc/periodic/15min/motd
+run-parts --test /etc/periodic/15min
+
+

If you're lazy and don't want to wait 15 minutes, run the script directly:

+
/etc/periodic/15min/motd
+
+

Log out and log back in, you should see the new MOTD!

+

Resources

+

https://kingtam.win/archives/apline-custom.html

+

I just copy/pasted and changed the MOTD.

+ +
+ + + + + + +
+ + + + + diff --git a/favicon-16x16.png b/favicon-16x16.png new file mode 100644 index 0000000..ac4b655 Binary files /dev/null and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png new file mode 100644 index 0000000..bbcbb89 Binary files /dev/null and b/favicon-32x32.png differ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..9c86c8d Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..850c042 --- /dev/null +++ b/index.html @@ -0,0 +1,187 @@ + + + + + + + + deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + + + + + + + + +
+ + + + + diff --git a/link-your-vimrc-file-on-windows/index.html b/link-your-vimrc-file-on-windows/index.html new file mode 100644 index 0000000..928e242 --- /dev/null +++ b/link-your-vimrc-file-on-windows/index.html @@ -0,0 +1,113 @@ + + + + + + + + how to link your vimrc file on windows · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

how to link your vimrc file on windows

+ + +

Posted on

+ + +

i code on my linux machine, and i use vim as my text editor.
+i've been using vim for almost 4 years, and i started to make my config file.
+i store it with git, along all my config files for my linux setup (aka my dot files).

+

here's the thing, i also use windows to code, and i also use vim.
+i also want to use the same config that i store in git.

+

to do so i need to do a symbolink link to my vimrc file. i dunno how to do that on windows.

+

here's how to do it:

+

cmd

+

if you use the old school, black boxed cmd.exe, you need to run these commands:

+
cd c:\users\_username_
+mklink .vimrc _path-to-vimrc_
+
+

and you should be good to go.
+just make sure it has been linked correctly with vim ~/.vimrc

+

powershell

+

if you use the new, blue boxed powershell.exe, it's a bit different:
+you can make it with powershell's language (or whatever they call the stuff they're using), but some require admin privileges, some require custom functions or something like that...

+

or you can keep it simple and use the cmd command to use cmd.exe to run the mklink program to make the symlink:

+
cd c:\users\_username_
+cmd /c mklink .vimrc _path-to-vimrc_
+
+

sources

+

i found this blog post to find out how to do symlinks on cmd,
+and i used this wikipedia article and this stackoverflow thread to learn how to do it on powershell.

+ +
+ + + + + + +
+ + + + + diff --git a/linux-kernel-contributions/index.html b/linux-kernel-contributions/index.html new file mode 100644 index 0000000..c20c984 --- /dev/null +++ b/linux-kernel-contributions/index.html @@ -0,0 +1,100 @@ + + + + + + + + my contributions to the linux kernel · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

my contributions to the linux kernel

+ + +

Posted on

+ + +

you read it right! i am a contributor to the linux kernel!

+

... but you are going to be dissapointed: my contributions are not going to change the world, just comments, alignments and documentation and stuff...

+

i submited something like 10 patches (as of april 10, 2018) and 3 patches have been accepted and are now into the kernel!

+

if you wanna check them out, you can read them on kernel.org.

+

yes, i am aware that Linus has a copy of the repo on github, but when i try to see my commits on github, i can't get them because there is too many commits and github can't get me the list.

+

so, here are my kernel contributions, listed by date:

+ + +
+ + + + + + +
+ + + + + diff --git a/mstile-150x150.png b/mstile-150x150.png new file mode 100644 index 0000000..f0768e0 Binary files /dev/null and b/mstile-150x150.png differ diff --git a/openbsd-setup/index.html b/openbsd-setup/index.html new file mode 100644 index 0000000..5719e0d --- /dev/null +++ b/openbsd-setup/index.html @@ -0,0 +1,101 @@ + + + + + + + + openbsd first setup after install · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

openbsd first setup after install

+ + +

Posted on

+ + +

just installed openbsd on my chromebook, seems to be working fine!

+

since it's my first time using openbsd, here are some stuff that i will start to do on my machines after installing openbsd:

+

enable doas

+

doas is kinda the equivalent of sudo. to enable it, run cp /etc/examples/doas.conf /etc to copy the doas config file.

+

disable root account

+

now that doas is ready, we dont need to root account anymore. to disable it, run usermod -p'*' root to set the root password to *. this will prevent root from log on directly to the machine (with su as an example), but with doas we can run doas sh to get a shell.

+

install missing firmware for your hardware

+

maybe your wifi card isn't working? or maybe you can't display any graphical interface? maybe that's because you don't have the firmware for it: here's how to install it:

+

run doas fw_update -i to see the missing firmwares.

+

so grab a flash drive, format it in fat filesystem format, go to firmware.openbsd.org, download the missing firmwares, along with the SHA256.sig and index.txt files, and put them on the usb key.

+

mount the flash drive on openbsd, and run doas fw_update -p *path of flash drive* to install the firmwares from the flash drive.

+

your missing firmware should not be anymore.

+ +
+ + + + + + +
+ + + + + diff --git a/processed_images/apple-rainbow.dae843aec90e4fd2.jpg b/processed_images/apple-rainbow.dae843aec90e4fd2.jpg new file mode 100644 index 0000000..c9e4908 Binary files /dev/null and b/processed_images/apple-rainbow.dae843aec90e4fd2.jpg differ diff --git a/processed_images/archlinux.456d8134dea984ad.jpg b/processed_images/archlinux.456d8134dea984ad.jpg new file mode 100644 index 0000000..6d79adb Binary files /dev/null and b/processed_images/archlinux.456d8134dea984ad.jpg differ diff --git a/processed_images/darth-vader.8707e38ea58ce5b9.jpg b/processed_images/darth-vader.8707e38ea58ce5b9.jpg new file mode 100644 index 0000000..657c426 Binary files /dev/null and b/processed_images/darth-vader.8707e38ea58ce5b9.jpg differ diff --git a/processed_images/epitech.2fb0f9976e9b5a67.jpg b/processed_images/epitech.2fb0f9976e9b5a67.jpg new file mode 100644 index 0000000..f7b2778 Binary files /dev/null and b/processed_images/epitech.2fb0f9976e9b5a67.jpg differ diff --git a/processed_images/nsa.881fde7a73711187.jpg b/processed_images/nsa.881fde7a73711187.jpg new file mode 100644 index 0000000..1fbdb27 Binary files /dev/null and b/processed_images/nsa.881fde7a73711187.jpg differ diff --git a/processed_images/pornhub.66a33fa0ddb7d786.jpg b/processed_images/pornhub.66a33fa0ddb7d786.jpg new file mode 100644 index 0000000..6e2db0f Binary files /dev/null and b/processed_images/pornhub.66a33fa0ddb7d786.jpg differ diff --git a/processed_images/puffy.00aa29dd6b99e171.jpg b/processed_images/puffy.00aa29dd6b99e171.jpg new file mode 100644 index 0000000..de28406 Binary files /dev/null and b/processed_images/puffy.00aa29dd6b99e171.jpg differ diff --git a/processed_images/thinkpad1.147b5c16ea6432da.jpg b/processed_images/thinkpad1.147b5c16ea6432da.jpg new file mode 100644 index 0000000..67fd57d Binary files /dev/null and b/processed_images/thinkpad1.147b5c16ea6432da.jpg differ diff --git a/processed_images/thinkpad2.d689f4141765e8ee.jpg b/processed_images/thinkpad2.d689f4141765e8ee.jpg new file mode 100644 index 0000000..ee62f27 Binary files /dev/null and b/processed_images/thinkpad2.d689f4141765e8ee.jpg differ diff --git a/processed_images/tux-verry-small.9bd45f15396c7ffa.jpg b/processed_images/tux-verry-small.9bd45f15396c7ffa.jpg new file mode 100644 index 0000000..2feb560 Binary files /dev/null and b/processed_images/tux-verry-small.9bd45f15396c7ffa.jpg differ diff --git a/processed_images/vim.aed1174ef81696b6.jpg b/processed_images/vim.aed1174ef81696b6.jpg new file mode 100644 index 0000000..7e452ca Binary files /dev/null and b/processed_images/vim.aed1174ef81696b6.jpg differ diff --git a/restart-chrome-url/index.html b/restart-chrome-url/index.html new file mode 100644 index 0000000..add987a --- /dev/null +++ b/restart-chrome-url/index.html @@ -0,0 +1,94 @@ + + + + + + + + restart chrome with a url · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

restart chrome with a url

+ + +

Posted on

+ + +

did you know that you can restart chrome/chromium with a simple url?

+

here is it: about://restart !

+

but this trick does not work with the <a> html tag, which seems logical, copy the link and paste it in a new tab to get it to work

+

it'd be annoying as fuck if you could click on links that restart your browser, imagine if an extension could replace every clickable link with this one! 😊

+

i think its usage is for chrome developers, the end user doesn't really care to type a url to restart their browser, they click on the x and they reopen it (duh).

+ +
+ + + + + + +
+ + + + + diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..41dfab8 --- /dev/null +++ b/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: +Allow: / +Sitemap: https://blog.x4m3.rocks/sitemap.xml diff --git a/safari-pinned-tab.svg b/safari-pinned-tab.svg new file mode 100644 index 0000000..6e9904a --- /dev/null +++ b/safari-pinned-tab.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/service-internal-infra-alpine/index.html b/service-internal-infra-alpine/index.html new file mode 100644 index 0000000..4568e26 --- /dev/null +++ b/service-internal-infra-alpine/index.html @@ -0,0 +1,182 @@ + + + + + + + + Setup a service on our internal infrastructure on Alpine Linux · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Setup a service on our internal infrastructure on Alpine Linux

+ + +

Posted on

+ + +

Now we have a basic internal infrastructure with:

+ +

But everything is on the same machine. While it could be okay, I will host the services I want on other machines.

+

I will run them on the same Proxmox cluster, but the possibilities are endless (as long you can get WireGuard running).

+

Get started

+

Install Alpine. Setup ssh and repositories.

+

WireGuard

+

We will set up WireGuard, but not a server, a regular peer that will connect to the WireGuard server.

+

Create a new peer on the WireGuard server, and get the config file ready.

+

Install

+

Install WireGuard:

+
apk add wireguard-tools
+
+

To load the WireGuard module on startup, edit

+
/etc/modules
+
+

and simply add

+
wireguard
+
+

and reboot.

+

Configure

+

Put the WireGuard config to

+
/etc/wireguard/wg0.conf
+
+

Start

+

Copy the init.d script for WireGuard like we did for the original server.

+

And ask it to start on boot.

+

Reboot and make sure everything works, you should see WireGuard logs when the machine is starting.

+

And the DNS should be working! Try to ping an internal DNS name.

+

Sometimes the DNS will go back to the system's default (probably your DHCP server's), so force the DNS as seen in the post about CoreDNS.

+

DNS entry

+

In the main server, edit CoreDNS to add a new DNS entry for the newly added peer.

+

Save and restart CoreDNS.

+

MOTD

+

Add the dynamic MOTD if you feel like it. I did.

+

Reverse proxy

+

Before installing and starting services, let's add a reverse proxy for security + some sweet TLS certs.

+

I'll be using caddy. You will need to enable the community repo first.

+
apk add caddy
+
+

Let's get a hello world:

+
/etc/caddy/Caddyfile
+
+
# global
+{
+        # step-ca ACME server
+        acme_ca https://10.131.111.1:444/acme/acme/directory
+}
+
+docker.philt3r docker.philt3r:80 {
+    respond "Hello, world!"
+}
+
+

I start the service on ports 80 and 443 to get the initial TLS certificate, I will remove access on port 80 afterward.

+

Don't start caddy yet.

+

TLS certificates

+

On our new server, we need to trust the root ca. Download the root ca, and ask the system to trust it:

+
apk add ca-certificates ca-certificates-bundle
+wget --no-check-certificate https://10.131.111.1:444/roots.pem -O /usr/local/share/ca-certificates/philt3r.crt
+update-ca-certificates 
+
+

Now we can start caddy and enable it on boot:

+
rc-service caddy start
+rc-update add caddy
+
+

You should get a Hello World on port 443. If you do, you can disable access from port 80 in the Caddyfile and restart caddy.

+

Install the service

+

Now we can install the service we want to host, start it, and configure caddy to be a reverse proxy for it.

+

Repeat the process for the other services you want to host.

+

Protip: serve the services on 127.0.0.1 and use caddy to restrict access only from the WireGuard peers (since there is the DNS restriction).

+

Sample Caddyfile:

+
# global
+{
+        # step-ca ACME server
+        acme_ca https://10.131.111.1:444/acme/acme/directory
+}
+
+docker.philt3r {
+        reverse_proxy 127.0.0.1:3000
+}
+
+

Docker

+

Since I'll be using Docker to host most services, I'll install it:

+
apk add docker docker-compose
+rc-update add docker
+rc-service docker start
+
+

Then spin up your docker containers and route them with caddy.

+ +
+ + + + + + +
+ + + + + diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..d81004f --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,66 @@ + + + + https://blog.x4m3.rocks/ + + + https://blog.x4m3.rocks/archlinux-how-old-is-your-installation/ + 2019-04-18 + + + https://blog.x4m3.rocks/caddy-ca-acme-alpine/ + 2023-06-28 + + + https://blog.x4m3.rocks/coredns-alpine/ + 2023-06-25 + + + https://blog.x4m3.rocks/dd-status/ + 2016-07-14 + + + https://blog.x4m3.rocks/docker-epitech-moulinette/ + 2020-01-19 + + + https://blog.x4m3.rocks/docker-private-registry/ + 2023-07-15 + + + https://blog.x4m3.rocks/dynamic-motd-alpine/ + 2023-06-30 + + + https://blog.x4m3.rocks/link-your-vimrc-file-on-windows/ + 2018-02-17 + + + https://blog.x4m3.rocks/linux-kernel-contributions/ + 2018-04-10 + + + https://blog.x4m3.rocks/openbsd-setup/ + 2019-03-01 + + + https://blog.x4m3.rocks/restart-chrome-url/ + 2018-04-09 + + + https://blog.x4m3.rocks/service-internal-infra-alpine/ + 2023-07-02 + + + https://blog.x4m3.rocks/thinkpad-custom-boot-logo/ + 2019-02-24 + + + https://blog.x4m3.rocks/wireguard-alpine/ + 2023-06-24 + + + https://blog.x4m3.rocks/zsh-vim-autocomplete-error/ + 2018-03-13 + + diff --git a/style.css b/style.css new file mode 100644 index 0000000..c712de4 --- /dev/null +++ b/style.css @@ -0,0 +1 @@ +html,body{background:#fffaf7;color:#2d2d2d;font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}a,a:visited{color:darkred;text-decoration:none}a:hover{text-decoration:underline}main{margin:auto;max-width:38rem;padding:.8rem}pre{background:#fff;overflow:scroll;padding:1rem}td{border:1px solid #2d2d2d;padding:10px}img{height:auto;max-width:100%}.homepage-list{list-style:none;padding:1rem 0}.homepage-list li{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:10px}@media (max-width: 38rem){.homepage-list li a{width:100%}} \ No newline at end of file diff --git a/thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif b/thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif new file mode 100644 index 0000000..1e396c6 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/apple-rainbow.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/archlinux.gif b/thinkpad-custom-boot-logo/boot-logo/archlinux.gif new file mode 100644 index 0000000..f2c68ab Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/archlinux.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/darth-vader.gif b/thinkpad-custom-boot-logo/boot-logo/darth-vader.gif new file mode 100644 index 0000000..4231b6d Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/darth-vader.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/epitech.gif b/thinkpad-custom-boot-logo/boot-logo/epitech.gif new file mode 100644 index 0000000..4f44a82 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/epitech.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/nsa.gif b/thinkpad-custom-boot-logo/boot-logo/nsa.gif new file mode 100644 index 0000000..f74b2f7 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/nsa.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/pornhub.gif b/thinkpad-custom-boot-logo/boot-logo/pornhub.gif new file mode 100644 index 0000000..6d86a3d Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/pornhub.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/puffy.gif b/thinkpad-custom-boot-logo/boot-logo/puffy.gif new file mode 100644 index 0000000..08179d3 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/puffy.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif b/thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif new file mode 100644 index 0000000..379b6e7 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/thinkpad1.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif b/thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif new file mode 100644 index 0000000..4f4a1b3 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/thinkpad2.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif b/thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif new file mode 100644 index 0000000..8460593 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/tux-verry-small.gif differ diff --git a/thinkpad-custom-boot-logo/boot-logo/vim.gif b/thinkpad-custom-boot-logo/boot-logo/vim.gif new file mode 100644 index 0000000..0927de0 Binary files /dev/null and b/thinkpad-custom-boot-logo/boot-logo/vim.gif differ diff --git a/thinkpad-custom-boot-logo/custom-logo.jpg b/thinkpad-custom-boot-logo/custom-logo.jpg new file mode 100644 index 0000000..f641b43 Binary files /dev/null and b/thinkpad-custom-boot-logo/custom-logo.jpg differ diff --git a/thinkpad-custom-boot-logo/default-logo.jpg b/thinkpad-custom-boot-logo/default-logo.jpg new file mode 100644 index 0000000..51688ff Binary files /dev/null and b/thinkpad-custom-boot-logo/default-logo.jpg differ diff --git a/thinkpad-custom-boot-logo/index.html b/thinkpad-custom-boot-logo/index.html new file mode 100644 index 0000000..9127881 --- /dev/null +++ b/thinkpad-custom-boot-logo/index.html @@ -0,0 +1,165 @@ + + + + + + + + how to put a custom boot logo on a thinkpad · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

how to put a custom boot logo on a thinkpad

+ + +

Posted on

+ + +

disclaimer

+

i need to warn you that you are on your own. even though it works fine, i'm not responsible of what you do.

+

introduction

+

you have a thinkpad. it's beautiful, it's fast, it's perfect, it doesn't run windows; there's just one thing that could be perfect: the boot logo.

+

by default on new models, your boot logo look like this:

+

+

to get a custom boot logo, you need:

+ +

get the BIOS update

+

to install your custom boot logo, you need to flash a BIOS update.

+

to download the BIOS update, go on lenovo's support website, choose drivers and updates and find your model.

+

next, go in the section BIOS/UEFI and download the BIOS Update (Bootable CD). it will download a iso image.

+

if you can't find the update image, that means that you're out of luck, and you can't get a custom boot logo. sorry.

+

convert the iso image

+

now that you have the iso image, you need to convert it to a img file. to do so, run the following command in a terminal:

+
geteltorito -o bios-image.img bios-image-downloaded.iso
+
+

if you don't have geteltorito, look online to install it.

+

flash the image on your usb drive

+

now it's time to flash the image on your usb drive. get the name of your flash drive using lsblk, plug your usb drive, and run lsblk again to see your drive.

+

go into the folder where the img file is located, and run in a terminal:

+
sudo dd if=bios-image.img of=/dev/sdX bs=1M status=progress oflag=sync
+
+

where X is your drive letter that you know thanks to lsblk.

+

get the gif file to use

+

if you want, i already have this selection of images ready to be used, or you can make your own!

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

you can see the requirements, go in your usb drive, open the readme.txt in the flash folder.

+

put the gif image in the flash folder, and name it LOGO1.JPG. copy that image, and name that one LOGO2.JPG.

+

check the readme.txt file to see the filenames, they might differ on different models.

+

flash the BIOS update

+

reboot your computer, and boot on the usb flash drive. if you don't know how, the internet should help you with that.

+

now that the flash utility has booted, choose the second option, and follow the instructions.

+

the computer will reboot, flash the update, and when it will reboot, you should get your custom boot logo!

+

+

if you want to go back to the default logo, simply reflash the bios update, when when asked if you want to use your custom logo, say no, and the default logo will be put back.

+ +
+ + + + + + +
+ + + + + diff --git a/wireguard-alpine/index.html b/wireguard-alpine/index.html new file mode 100644 index 0000000..96e205a --- /dev/null +++ b/wireguard-alpine/index.html @@ -0,0 +1,347 @@ + + + + + + + + Setup WireGuard server on Alpine Linux · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

Setup WireGuard server on Alpine Linux

+ + +

Posted on

+ + +

Let's do this baremetal, no Docker!

+

I will do this inside a Proxmox virtual machine.

+

Get started

+

Start by installing Alpine Linux: Run the installer, next, next, next, and boot the os once it's done.

+

Setup ssh

+

Copy ssh key (run this on your local machine):

+
ssh-copy-id -i ~/.ssh/id_rsa.pub user@ip
+
+

Login via ssh, and install your favorite editor:

+
doas apk add vim
+
+

Edit ssh config to force ssh key use:

+
doas vim /etc/ssh/sshd_config
+
+

Find and update these statements:

+
PermitRootLogin no
+PubkeyAuthentication yes
+
+

Restart ssh service, logout, and log back in

+
doas rc-service sshd restart
+
+

Setup alpine package manager

+

I use mirrors.ircam.fr as my mirror

+

Open

+
/etc/apk/repositories
+
+

add the community repo, and run updates:

+
doas apk -U upgrade
+
+

WireGuard basics

+

Install WireGuard:

+
doas apk add wireguard-tools
+
+

Kernel module

+

Load the module

+
doas modprobe wireguard
+
+

To launch the module on startup, edit

+
/etc/modules
+
+

and simply add

+
wireguard
+
+

at the bottom, and save the file.

+

IP forwarding

+

Edit

+
/etc/sysctl.conf
+
+

and add

+
net.ipv4.ip_forward = 1
+
+

at the bottom of the file, and save

+

Launch sysctl on startup with

+
doas rc-update add sysctl
+
+

and reboot.

+

IP Addresses

+

Pick a range if ip addresses to use: RFC 1918

+

I'll pick 10.131.111.x for the WireGuard peers.

+

Calculate your CIDR: https://www.ipaddressguide.com/cidr

+

Here's my network layout:

+ +

Network services:

+ +

WireGuard:

+ +

Generate keys for WireGuard

+

Do everything as root (doas is the equivalent of sudo):

+
doas su
+
+

Move to the wireguard configuration, I'll store everything there for easy access:

+
cd /etc/wireguard/
+
+

Generate the private and public key, store them in files (we'll use them later):

+
wg genkey | tee philt3r-privatekey | wg pubkey > philt3r-publickey
+
+

Configure server interface

+

All the server configuration will happen in

+
/etc/wireguard/wg0.conf
+
+

Protip for vim users: To add content of a file in current buffer directly: StackOverflow answer

+
[Interface]
+# Name = wg0
+Address = 10.131.111.1/24
+ListenPort = 51820
+PrivateKey = <server-private-key>
+PostUp = iptables -t nat -A POSTROUTING -s 10.131.111.0/24 -o %i -j MASQUERADE;
+PostUp = iptables -t nat -A POSTROUTING -s 10.131.110.0/24 -o %i -j MASQUERADE;
+PostUp = iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT;
+PostUp = iptables -A FORWARD -i %i -j ACCEPT;
+PostUp = iptables -A FORWARD -o %i -j ACCEPT;
+PostDown = iptables -t nat -D POSTROUTING -s 10.131.111.0/24 -o %i -j MASQUERADE;
+PostDown = iptables -t nat -D POSTROUTING -s 10.131.110.0/24 -o %i -j MASQUERADE;
+PostDown = iptables -D INPUT -p udp -m udp --dport 51820 -j ACCEPT;
+PostDown = iptables -D FORWARD -i %i -j ACCEPT;
+PostDown = iptables -D FORWARD -o %i -j ACCEPT;
+
+

Once it's good, make sure only root can read and write to the files:

+
chmod 600 /etc/wireguard/*
+
+

Add new peer

+

You will need to repeat this for each new peer

+
cd /etc/wireguard/
+
+

Generate keys

+

Starting now, name is a placeholder for the name of the peer.

+

I typically use the format name-of-person followed by device-name. For example, the peer for my phone will be phil-iphone.

+

Create folder to store keys for the peer:

+
mkdir -p peers/name
+
+

Generate preshared key (not required):

+
wg genpsk | tee peers/name/preshared.psk
+
+

Generate private and public keys for the peer:

+
wg genkey | tee peers/name/private.key | wg pubkey > peers/name/public.key
+
+

Update server configuration

+

Edit your wg0.conf, add at the bottom:

+
[Peer]
+# Name = name
+PublicKey = <peers/name/public.key>
+PresharedKey = <peers/name/preshared.psk>
+AllowedIPs = 10.131.111.2/32
+AllowedIPs = 10.131.110.0/24
+AllowedIPs = 10.131.111.0/24
+
+

Peer configuration

+

Now let's create the configuration to give to the peer:

+

Create the file

+
peers/name/philt3r-name.wg.conf
+
+

And put the following

+
[Interface]
+PrivateKey = <peers/name/private.key>
+Address = 10.131.111.2/24
+#DNS = 10.131.111.1
+
+[Peer]
+PublicKey = <server-public-key>
+PresharedKey = <peers/name/preshared.psk>
+Endpoint = <server-ip>:51820
+AllowedIPs = 10.131.110.0/24
+AllowedIPS = 10.131.111.0/24
+PersistentKeepalive = 25
+
+

DNS info is not used yet, it's normal, I will enable it once my DNS server will be created (not in this blog post though).

+

Distribute config

+

Either give the configuration file we just created, or you can have multiple choices.

+

QR Code

+

Start by installing

+
apk add libqrencode
+
+

And run

+
qrencode -t ansiutf8 < peers/name/philt3r-name.wg.conf
+
+

Base64

+

Note: I'm using base64 on Alpine, which comes from BusyBox, the CLI may be different depending on the operating system you're using.

+

Encode the configuration file to a base64 string:

+
cat philt3r-name.wg.conf | base64 -w 0
+
+

And on the other device, decode the string and save to a file:

+
base64 -d > philt3r-name.wg.conf
+
+

Put the base64 encoded string, and send a EOF (usually ctrl + d).

+

Restart WireGuard

+

If you already have WireGuard running, simply run

+
rc-service wg restart
+
+

to restart the server with your new peer.

+

Start WireGuard manually

+

Make sure to open the port on your router in UDP mode! I spent a lot of time debugging to realize that my port was in TCP, double check!

+

Make sure to be root before, don't use doas or sudo!

+
wg-quick up wg0
+
+

On the peer, start the tunnel.

+

On the server, run

+
wg
+
+

to check the status of WireGuard. You should see the peer and some stats it is connected.

+

If you do not see info about the peer even if it is not connected, that means you did something wrong in the configuration!

+

From your peer, you should be able to ping the WireGuard internal IP:

+
10.131.111.1
+
+ +

If you can ping the ip, you're good!

+

You may not be able to go on the internet, or even make DNS requests, it's normal.

+

We are just testing if the tunnel works. You can stop the tunnel.

+

Stop WireGuard manually

+
wg-quick down wg0
+
+

Script to launch on server startup

+

To start WireGuard on startup, we will write an OpenRC script. It will be located in

+
/etc/init.d/wg
+
+

Put the following:

+
#!/sbin/openrc-run
+#
+
+description="WireGuard"
+
+depend() {
+    need localmount net sysctl
+    after bootmisc
+}
+
+start() {
+    ebegin "Starting WireGuard"
+    wg-quick up wg0
+    eend $?
+}
+
+stop() {
+    ebegin "Stopping WireGuard"
+    wg-quick down wg0
+    eend $?
+}
+
+status() {
+    wg show wg0
+}
+
+

Give it executable access

+
chmod +x /etc/init.d/wg
+
+

Manual

+ +

Startup

+ +

Reboot and make sure everything works, you should see WireGuard logs when your server is starting.

+

Resources

+

These resources helped me when setting up my WireGuard server. Thanks!

+ + +
+ + + + + + +
+ + + + + diff --git a/zsh-vim-autocomplete-error/index.html b/zsh-vim-autocomplete-error/index.html new file mode 100644 index 0000000..e945bd6 --- /dev/null +++ b/zsh-vim-autocomplete-error/index.html @@ -0,0 +1,102 @@ + + + + + + + + error on zsh when using vim and autocomplete · deadbaed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

+ deadbaed +
broke my bed now it's dead +

+
+
+ + + +
+

error on zsh when using vim and autocomplete

+ + +

Posted on

+ + +

do you use zsh and ohmyzsh ?

+

do you run into an issue when you are about to edit a file with vim, and you use the Tab key to autocomplete the filename, but instead you get something like this:

+
$ vim ~/filena<TAB>
+_arguments:448: _vim_files: function definition file not found
+
+

annoying af, right ?

+

how to fix it

+

here's how to fix it: delete the zcompdump directory off your personal directory, and reload your zsh config file (or close and open a new shell).

+
rm -rf ~/.zcompdump*; source ~/.zshrc;
+
+

it took me at least 15 mins to find that .... hopefully i save some time for you .

+

sources

+

stackoverflow and github

+ +
+ + + + + + +
+ + + + +