<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://howto.as215545.xyz/feed.xml" rel="self" type="application/atom+xml" /><link href="https://howto.as215545.xyz/" rel="alternate" type="text/html" /><updated>2026-07-27T20:15:35+00:00</updated><id>https://howto.as215545.xyz/feed.xml</id><title type="html">Dorinel Filip How-To’s</title><subtitle>My own (but public) repostory of tutorials</subtitle><entry><title type="html">How to setup 802.11x authenticated WAN using OpenWRT?</title><link href="https://howto.as215545.xyz/how-to-setup-802.11x-wired-connection-with-openWRT/" rel="alternate" type="text/html" title="How to setup 802.11x authenticated WAN using OpenWRT?" /><published>2023-12-18T00:00:00+00:00</published><updated>2023-12-18T00:00:00+00:00</updated><id>https://howto.as215545.xyz/how-to-setup-802.11x-wired-connection-with-openWRT</id><content type="html" xml:base="https://howto.as215545.xyz/how-to-setup-802.11x-wired-connection-with-openWRT/"><![CDATA[<p>This tutorial explains how to configure OpenWRT to authentificate the WAN connection using 802.11x EAP-TLS.</p>

<!--end_excerpt-->

<h2 id="step-1-make-sure-your-openwrt-image-include-all-the-needed-packages">Step 1: Make sure your OpenWRT image include all the needed packages</h2>

<p>Make sure that your OpenWRT at least includes the following packages:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>libopenssl hostapd-common wpad-openssl -wpad-basic-wolfssl
</code></pre></div></div>
<p>Note: <code class="language-plaintext highlighter-rouge">wpad-basic-wolfssl</code> is explicitly excluded.</p>

<p>You can easely get your image build using the <a href="https://firmware-selector.openwrt.org/">OpenWRT Firmware Selector</a>.</p>

<h2 id="step-2-create-wpa_suplicant-configuration-file">Step 2: Create wpa_suplicant configuration file</h2>

<p>We need to create:</p>
<ul>
  <li>/etc/config/wpadot1x.conf</li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
ap_scan=0
network={
	key_mgmt=IEEE8021X
	eap=PEAP
	identity="username"
	password=""
	anonymous_identity="username"
	pairwise=CCMP
	phase2="auth=MSCHAPV2"
	ca_cert="/etc/config/80211x-CA.pem"
	priority=2
}
</code></pre></div></div>

<h2 id="step-3-attach-a-script-to-run-wpa_supplicant-when-the-wan-interface-goes-up">Step 3: Attach a script to run wpa_supplicant when the wan interface goes up</h2>

<p>Create <code class="language-plaintext highlighter-rouge">/etc/hotplug.d/iface/99-ifup-wan</code> as following:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#!/bin/sh
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] &amp;&amp; {
    logger "iface wan up detected..."
    wpa_supplicant -s -t -D wired -B -i eth1 -c /etc/config/wpadot1x.conf
    # Wait 3 s
    sleep 3
    echo "wan ifup -&gt; dhcp releases"
    # Renew DHCP adresses on all the interfaces
    PID=`pidof udhcpc` &amp;&amp; kill -SIGUSR1 $PID
}
exit 0
</code></pre></div></div>

<p>Make the script executable:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>chmod +x /etc/hotplug.d/iface/99-ifup-wan
</code></pre></div></div>

<p>Restart the interface:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ifup wan
</code></pre></div></div>

<p><strong>Note</strong>: <code class="language-plaintext highlighter-rouge">eth1</code> should be replaced with the actual WAN interface.</p>

<p><strong>Note</strong>: The CA certificate is optional, but recomanded for security.</p>

<p><strong>Note</strong>: If you are looking for UPB’s CA certificate you can download it from <a href="/assets/UPB-CA.crt">here</a>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[This tutorial explains how to configure OpenWRT to authentificate the WAN connection using 802.11x EAP-TLS.]]></summary></entry><entry><title type="html">How to make a docker-compose application to autostart as a service?</title><link href="https://howto.as215545.xyz/docker-compose-autostart/" rel="alternate" type="text/html" title="How to make a docker-compose application to autostart as a service?" /><published>2022-07-05T00:00:00+00:00</published><updated>2022-07-05T00:00:00+00:00</updated><id>https://howto.as215545.xyz/docker-compose-autostart</id><content type="html" xml:base="https://howto.as215545.xyz/docker-compose-autostart/"><![CDATA[<p>In this tutorial we explain how to enable on-boot autostart for a docker-compose application using systemd on Ubuntu.</p>

<!--end_excerpt-->

<h1 id="on-ubuntu">On Ubuntu</h1>

<p>Create a file <code class="language-plaintext highlighter-rouge">/etc/systemd/system/docker-compose-example.service</code> as following:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
User=myuser # CHANGE THIS
Group=mygroup # CHANGE THIS
WorkingDirectory=/home/dockermgr/service # CHANGE THIS
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
</code></pre></div></div>

<p>On some older systems, Docker Compose might be standalone. In this case, you should change two lines as:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
</code></pre></div></div>

<p>To start the service use systemctl:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Autostart systemd service
sudo systemctl enable docker-compose-example.service
# Start systemd service now
sudo systemctl start docker-compose-example.service
</code></pre></div></div>]]></content><author><name></name></author><summary type="html"><![CDATA[In this tutorial we explain how to enable on-boot autostart for a docker-compose application using systemd on Ubuntu.]]></summary></entry><entry><title type="html">How to change the MAC address of an interface on MacOS?</title><link href="https://howto.as215545.xyz/change-macos-mac-address/" rel="alternate" type="text/html" title="How to change the MAC address of an interface on MacOS?" /><published>2022-04-30T00:00:00+00:00</published><updated>2022-04-30T00:00:00+00:00</updated><id>https://howto.as215545.xyz/change-macos-mac-address</id><content type="html" xml:base="https://howto.as215545.xyz/change-macos-mac-address/"><![CDATA[<p>This tutorial explains how to change the MAC address/physical adress of an network interface on MacOS.
<!--end_excerpt--></p>

<p>Step 1: Make sure your interface is disconnected.</p>

<p>If your network connection is active, you will get the following error:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address
</code></pre></div></div>

<p>Step 2:</p>

<p>Open <strong>Terminal</strong> and type:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo ifconfig en0 ether 12:34:56:78:90:ab
</code></pre></div></div>
<p>where:</p>
<ul>
  <li>en0 is the name of the interface</li>
  <li>12:34:56:78:90:ab is the desired MAC address</li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[This tutorial explains how to change the MAC address/physical adress of an network interface on MacOS.]]></summary></entry><entry><title type="html">How to run NGINX-Proxy-Manager using Docker Swarm?</title><link href="https://howto.as215545.xyz/docker-swarm-nginx-proxy-manager/" rel="alternate" type="text/html" title="How to run NGINX-Proxy-Manager using Docker Swarm?" /><published>2022-04-28T00:00:00+00:00</published><updated>2022-04-28T00:00:00+00:00</updated><id>https://howto.as215545.xyz/docker-swarm-nginx-proxy-manager</id><content type="html" xml:base="https://howto.as215545.xyz/docker-swarm-nginx-proxy-manager/"><![CDATA[<p>NGINX-Proxy-Manager is a very simple method to set a NGINX Ingress. In this tutorial we present a very simple way to run it on your for your Docker Swarm cluster.</p>

<!--end_excerpt-->

<p>Step 1: Make sure you initialized Docker Swarm</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker swarm init
</code></pre></div></div>

<p>Step 2: Create an external network</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker network create --driver overlay --opt encrypted --attachable --scope "swarm" proxy_net
</code></pre></div></div>

<p>Step 3: Run nginx-admin as a Swarm service</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">version</span><span class="pi">:</span> <span class="s1">'</span><span class="s">3.6'</span>
<span class="na">services</span><span class="pi">:</span>
  <span class="na">app</span><span class="pi">:</span>
    <span class="na">image</span><span class="pi">:</span> <span class="s1">'</span><span class="s">jc21/nginx-proxy-manager:latest'</span>
    <span class="na">networks</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s">proxy_net</span>
    <span class="na">ports</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="na">target</span><span class="pi">:</span> <span class="m">80</span>
        <span class="na">published</span><span class="pi">:</span> <span class="m">80</span>
        <span class="na">protocol</span><span class="pi">:</span> <span class="s">tcp</span>
        <span class="na">mode</span><span class="pi">:</span> <span class="s">host</span>

      <span class="pi">-</span> <span class="na">target</span><span class="pi">:</span> <span class="m">443</span>
        <span class="na">published</span><span class="pi">:</span> <span class="m">443</span>
        <span class="na">protocol</span><span class="pi">:</span> <span class="s">tcp</span>
        <span class="na">mode</span><span class="pi">:</span> <span class="s">host</span>

      <span class="pi">-</span> <span class="s2">"</span><span class="s">81:81"</span>
    <span class="na">volumes</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s">data:/data</span>
      <span class="pi">-</span> <span class="s">letsencrypt:/etc/letsencrypt</span>

<span class="na">volumes</span><span class="pi">:</span>
  <span class="na">data</span><span class="pi">:</span>
  <span class="na">letsencrypt</span><span class="pi">:</span>

<span class="na">networks</span><span class="pi">:</span>
  <span class="na">proxy_net</span><span class="pi">:</span>
    <span class="na">external</span><span class="pi">:</span> <span class="no">true</span>
</code></pre></div></div>]]></content><author><name></name></author><summary type="html"><![CDATA[NGINX-Proxy-Manager is a very simple method to set a NGINX Ingress. In this tutorial we present a very simple way to run it on your for your Docker Swarm cluster.]]></summary></entry><entry><title type="html">How to make a socket address reuseable using setsockopt()?</title><link href="https://howto.as215545.xyz/how-to-set-a-socket-address-as-reusable/" rel="alternate" type="text/html" title="How to make a socket address reuseable using setsockopt()?" /><published>2022-04-12T00:00:00+00:00</published><updated>2022-04-12T00:00:00+00:00</updated><id>https://howto.as215545.xyz/how-to-set-a-socket-address-as-reusable</id><content type="html" xml:base="https://howto.as215545.xyz/how-to-set-a-socket-address-as-reusable/"><![CDATA[<p>Did you just get an “address already in use” error while calling bind()?</p>

<p>Use the following snippet to get rid of it:</p>

<pre><code class="language-C">int enable = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &amp;enable, sizeof(int)) &lt; 0)
    perror("setsockopt(SO_REUSEADDR) failed");
</code></pre>
<!--end_excerpt-->]]></content><author><name></name></author><summary type="html"><![CDATA[Did you just get an “address already in use” error while calling bind()? Use the following snippet to get rid of it: int enable = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &amp;enable, sizeof(int)) &lt; 0) perror("setsockopt(SO_REUSEADDR) failed");]]></summary></entry><entry><title type="html">How to print a maze-looking pattern using C</title><link href="https://howto.as215545.xyz/maze-pattern-using-C/" rel="alternate" type="text/html" title="How to print a maze-looking pattern using C" /><published>2022-04-12T00:00:00+00:00</published><updated>2022-04-12T00:00:00+00:00</updated><id>https://howto.as215545.xyz/maze-pattern-using-C</id><content type="html" xml:base="https://howto.as215545.xyz/maze-pattern-using-C/"><![CDATA[<p>Here is how you can print a random maze-looking pattern using C.</p>

<!--end_excerpt-->

<pre><code class="language-C">#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;time.h&gt;
#include &lt;unistd.h&gt;

void draw_diagnonal_lines(int count) {
  for (int i = 0; i &lt; count; i++) {
    if (rand() % 2 == 0) {
      printf("╱");
    } else {
      printf("╲");
    }
  }
}

void draw_orizonal_lines(int count) {
  for (int i = 0; i &lt; count; i++)
    printf("─");
}

int main(void) {
  struct winsize w;
  ioctl(STDOUT_FILENO, TIOCGWINSZ, &amp;w);

  printf("lines %d\n", w.ws_row);
  printf("columns %d\n", w.ws_col);

  printf("┌");
  draw_orizonal_lines(w.ws_col - 2);
  printf("┐\n");

  srand(time(NULL));
  for (int line = 0; line &lt; w.ws_row - 3; line++) {
    printf("│");
    draw_diagnonal_lines(w.ws_col - 2);
    printf("│");

    puts("");
    // sleep(1);
  }

  printf("└");
  draw_orizonal_lines(w.ws_col - 2);
  printf("┘\n");

  return 0;
}
</code></pre>]]></content><author><name></name></author><summary type="html"><![CDATA[Here is how you can print a random maze-looking pattern using C.]]></summary></entry></feed>