Compare commits

..

2 commits

20 changed files with 1346 additions and 11 deletions

View file

@ -0,0 +1,24 @@
---
title: "Block and Filter Spam Requests With User-Agents in Nginx"
date: 2024-09-05T16:58:04+03:00
draft: false
---
My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.
Adapt the following for your use case and simply place it in every nginx.conf that is `ln -s` linked to your `/etc/nginx/sites-enabled` (*it should be under the `listen 443` server block if you use certbot. Don't add it under `location` it should be on the same level as `listen [::]:443 ssl;`*)
```nginx
if ($http_user_agent ~* "Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot") {
return 404;
}
```
To see what kind of requests are being made you can check out the following NGINX file `/var/log/nginx/access.log`. Scroll all the way down (if you use vim `G`, for nano - `Ctrl + End`)
I adapted this guide from this fella over here who blocked all Apple devices on his VPS, [read more](https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html).
## A better alternative - Basic HTTP Authentication
A better way of blocking unwated access to your website is to use apache2 + NGINX's basic HTTP authentication, [read my guide](/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache).

View file

@ -0,0 +1,55 @@
---
title: "Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache"
date: 2024-09-05T17:05:07+03:00
draft: false
---
Here's how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system's (*or your vps'*) resources for yourself.
The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith's tutorial and have NGINX running with certbot for certificates.
## Create a username and password for authentication (*or more than 1 user*)
First:
```bash
sudo apt install apache2
```
Then:
```bash
sudo apt install apache2-utils
```
Create a username you wish to authenticate with the following comnmand:
```bash
sudo htpasswd -c /etc/apache2/.htpasswd admin1
```
You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.
If you wish to create multiple other users simply remove `-c` from the command and change the name.
```bash
sudo htpasswd /etc/apache2/.htpasswd admin2
```
Then provide a new password (the same password can also work but it's more secure that way).
## Add the `htpasswd` file to NGINX
Navigate to the NGINX configuration file you wish to protect:
```bash
nano /etc/nginx/sites-available/<yourFileHere>
```
Add the following in the same `server` block and on the same level as `listen [::]:443 ssl;`:
```nginx
auth_basic "Administrators Area";
auth_basic_user_file /etc/apache2/.htpasswd;
```
Further readering [here](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/).

View file

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en" class="main-background-image">
<head>
<title>Block and Filter Spam Requests With User-Agents in Nginx | vodoraslo&#39;s blog</title>
<link rel="canonical" href="https://vodoraslo.xyz/">
<link rel='alternate' type='application/rss+xml' title="vodoraslo&#39;s blog RSS" href='/index.xml'>
<link rel='stylesheet' type='text/css' href='/style.css?v=1.0.0.12'>
<link rel="icon" href="/favicon.ico">
<meta name="description" content="My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.
Adapt the following for your use case and simply place it in every nginx.conf that is ln -s linked to your /etc/nginx/sites-enabled (it should be under the listen 443 server block if you use certbot. Don&rsquo;t add it under location it should be on the same level as listen [::]:443 ssl;)"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="index, follow">
<meta charset="utf-8">
</head>
<div class="main-background-image">
<body>
<main>
<header><h1 style="margin-top: 0%; padding-top: 0.5em;" id="tag_Block and Filter Spam Requests With User-Agents in Nginx">Block and Filter Spam Requests With User-Agents in Nginx</h1></header>
<hr style="color:var(--strong);background-color: var(--strong); border-color: var(--strong);"><article style="padding: 0% 2.5% 0% 2.5%;">
<div class="breadcrumbs">
<nav><a href="/">vodoraslo</a> /&nbsp;<a href="/articles/">Articles</a> /&nbsp;Block and Filter Spam Requests With User-Agents in Nginx</nav>
</div>
<small><em><p style="color: var(--muted_text);">作成日: <time datetime="2024-09-05T16:58:04&#43;03:00" style="color: var(--muted_text);">2024年9月5日 (木)</time>, 最終更新日: <time datetime="2024-09-05T17:22:43&#43;03:00" style="color: var(--muted_text);">2024年9月5日 (木)</time> </p></em></small>
<div class="post-content"><p>My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.</p>
<p>Adapt the following for your use case and simply place it in every nginx.conf that is <code>ln -s</code> linked to your <code>/etc/nginx/sites-enabled</code> (<em>it should be under the <code>listen 443</code> server block if you use certbot. Don&rsquo;t add it under <code>location</code> it should be on the same level as <code>listen [::]:443 ssl;</code></em>)</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-nginx" data-lang="nginx"><span style="display:flex;"><span><span style="color:#c678dd">if</span> <span style="color:#98c379">(</span><span style="color:#dcaeea">$http_user_agent</span> ~<span style="color:#56b6c2">*</span> <span style="color:#98c379">&#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&#34;)</span> {
</span></span><span style="display:flex;"><span> <span style="color:#c678dd">return</span> <span style="color:#d19a66">404</span>;
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<p>To see what kind of requests are being made you can check out the following NGINX file <code>/var/log/nginx/access.log</code>. Scroll all the way down (if you use vim <code>G</code>, for nano - <code>Ctrl + End</code>)</p>
<p>I adapted this guide from this fella over here who blocked all Apple devices on his VPS, <a href="https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html">read more</a>.</p>
<h2 id="a-better-alternative---basic-http-authentication">A better alternative - Basic HTTP Authentication<a hidden class="anchor" aria-hidden="true" href="#a-better-alternative---basic-http-authentication">#</a></h2>
<p>A better way of blocking unwated access to your website is to use apache2 + NGINX&rsquo;s basic HTTP authentication, <a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache">read my guide</a>.</p>
<div style="text-align: right;">
</div></div>
<br>
<hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);">
<div id="nextprev">
<a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/"><div id="prevart"><i>Previous:</i><br>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</div></a>
<a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/"><div id="nextart"><i>Next:</i><br>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</div></a>
</div>
<div >
</div>
</article>
</main>
<footer style="padding-top: 0.5em;">
<div style="padding-bottom: 0.2em; display: inline-block;"><a href="https://vodoraslo.xyz/articles" title="List of all my articles and writings.">📜 Articles</a> <strong>&bull;</strong> <a href="https://vodoraslo.xyz/library" title="My personal library.">📚 Library</a> <strong>&bull;</strong> <a href="https://wiki.vodoraslo.xyz" title="My personal Wiki page.">🌐 Wiki</a> <strong>&bull;</strong> <a href="https://vodoraslo.xyz/index.xml" title="Subscribe via RSS for updates.">📰 RSS</a><hr></div>
<div style="padding-bottom: 0.7em;" class="index-links"><a href="https://vodoraslo.xyz/" title="Return to the homepage.">🏠 Homepage</a></div>
</footer>
</body>
</div>
</html>

View file

@ -76,6 +76,7 @@ That is no more! I&rsquo;m sick of doing it and I don&rsquo;t know how I just re
<hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);"> <hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);">
<div id="nextprev"> <div id="nextprev">
<a href="/articles/blog/hugo-drafts-showing-in-production/"><div id="prevart"><i>Previous:</i><br>Hugo: Drafts Showing in Production</div></a> <a href="/articles/blog/hugo-drafts-showing-in-production/"><div id="prevart"><i>Previous:</i><br>Hugo: Drafts Showing in Production</div></a>
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="nextart"><i>Next:</i><br>Block and Filter Spam Requests With User-Agents in Nginx</div></a>
</div> </div>
<div ><div style="clear:both" class=taglist> <div ><div style="clear:both" class=taglist>
Tags: [<a id="tag_blog" href="https://vodoraslo.xyz/tags/blog">Blog</a>] Tags: [<a id="tag_blog" href="https://vodoraslo.xyz/tags/blog">Blog</a>]

View file

@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en" class="main-background-image">
<head>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache | vodoraslo&#39;s blog</title>
<link rel="canonical" href="https://vodoraslo.xyz/">
<link rel='alternate' type='application/rss+xml' title="vodoraslo&#39;s blog RSS" href='/index.xml'>
<link rel='stylesheet' type='text/css' href='/style.css?v=1.0.0.12'>
<link rel="icon" href="/favicon.ico">
<meta name="description" content="Here&rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&rsquo;s (or your vps&rsquo;) resources for yourself.
The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&rsquo;s tutorial and have NGINX running with certbot for certificates.
Create a username and password for authentication (or more than 1 user) First:"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="index, follow">
<meta charset="utf-8">
</head>
<div class="main-background-image">
<body>
<main>
<header><h1 style="margin-top: 0%; padding-top: 0.5em;" id="tag_Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache">Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</h1></header>
<hr style="color:var(--strong);background-color: var(--strong); border-color: var(--strong);"><article style="padding: 0% 2.5% 0% 2.5%;">
<div class="breadcrumbs">
<nav><a href="/">vodoraslo</a> /&nbsp;<a href="/articles/">Articles</a> /&nbsp;Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</nav>
</div>
<small><em><p style="color: var(--muted_text);">作成日: <time datetime="2024-09-05T17:05:07&#43;03:00" style="color: var(--muted_text);">2024年9月5日 (木)</time>, 最終更新日: <time datetime="2024-09-05T17:22:43&#43;03:00" style="color: var(--muted_text);">2024年9月5日 (木)</time> </p></em></small>
<div class="post-content"><p>Here&rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&rsquo;s (<em>or your vps&rsquo;</em>) resources for yourself.</p>
<p>The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&rsquo;s tutorial and have NGINX running with certbot for certificates.</p>
<h2 id="create-a-username-and-password-for-authentication-or-more-than-1-user">Create a username and password for authentication (<em>or more than 1 user</em>)<a hidden class="anchor" aria-hidden="true" href="#create-a-username-and-password-for-authentication-or-more-than-1-user">#</a></h2>
<p>First:</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo apt install apache2</span></span></code></pre></div>
<p>Then:</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo apt install apache2-utils</span></span></code></pre></div>
<p>Create a username you wish to authenticate with the following comnmand:</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo htpasswd -c /etc/apache2/.htpasswd admin1</span></span></code></pre></div>
<p>You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.</p>
<p>If you wish to create multiple other users simply remove <code>-c</code> from the command and change the name.</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo htpasswd /etc/apache2/.htpasswd admin2</span></span></code></pre></div>
<p>Then provide a new password (the same password can also work but it&rsquo;s more secure that way).</p>
<h2 id="add-the-htpasswd-file-to-nginx">Add the <code>htpasswd</code> file to NGINX<a hidden class="anchor" aria-hidden="true" href="#add-the-htpasswd-file-to-nginx">#</a></h2>
<p>Navigate to the NGINX configuration file you wish to protect:</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nano /etc/nginx/sites-available/&lt;yourFileHere&gt;</span></span></code></pre></div>
<p>Add the following in the same <code>server</code> block and on the same level as <code>listen [::]:443 ssl;</code>:</p>
<div class="highlight">
<pre tabindex="0" class="chroma"><code class="language-nginx" data-lang="nginx"><span style="display:flex;"><span><span style="color:#c678dd">auth_basic</span> <span style="color:#98c379">&#34;Administrators</span> <span style="color:#98c379">Area&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#c678dd">auth_basic_user_file</span> <span style="color:#98c379">/etc/apache2/.htpasswd</span>;</span></span></code></pre></div>
<p>Further readering <a href="https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/">here</a>.</p>
<div style="text-align: right;">
</div></div>
<br>
<hr style="color:var(--strong); margin: 0; background-color: var(--strong); border-color: var(--strong);">
<div id="nextprev">
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><div id="prevart"><i>Previous:</i><br>Block and Filter Spam Requests With User-Agents in Nginx</div></a>
</div>
<div >
</div>
</article>
</main>
<footer style="padding-top: 0.5em;">
<div style="padding-bottom: 0.2em; display: inline-block;"><a href="https://vodoraslo.xyz/articles" title="List of all my articles and writings.">📜 Articles</a> <strong>&bull;</strong> <a href="https://vodoraslo.xyz/library" title="My personal library.">📚 Library</a> <strong>&bull;</strong> <a href="https://wiki.vodoraslo.xyz" title="My personal Wiki page.">🌐 Wiki</a> <strong>&bull;</strong> <a href="https://vodoraslo.xyz/index.xml" title="Subscribe via RSS for updates.">📰 RSS</a><hr></div>
<div style="padding-bottom: 0.7em;" class="index-links"><a href="https://vodoraslo.xyz/" title="Return to the homepage.">🏠 Homepage</a></div>
</footer>
</body>
</div>
</html>

View file

@ -38,6 +38,8 @@ blog (8) hackbook (59) library (74) ted-kaczynski (15) updates (3) "/>
</ul> </ul>
</div> </div>
<ul> <ul>
<li class="index-links"><time datetime="2024-09-05T17:05:07&#43;03:00">2024 Sep 05</time> &ndash; <a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/">Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</a></li>
<li class="index-links"><time datetime="2024-09-05T16:58:04&#43;03:00">2024 Sep 05</time> &ndash; <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/">Block and Filter Spam Requests With User-Agents in Nginx</a></li>
<li class="index-links"><time datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash; <a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</a></li> <li class="index-links"><time datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash; <a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</a></li>
<li class="index-links"><time datetime="2024-03-17T17:53:39&#43;03:00">2024 Mar 17</time> &ndash; <a href="/articles/blog/hugo-drafts-showing-in-production/">Hugo: Drafts Showing in Production</a></li> <li class="index-links"><time datetime="2024-03-17T17:53:39&#43;03:00">2024 Mar 17</time> &ndash; <a href="/articles/blog/hugo-drafts-showing-in-production/">Hugo: Drafts Showing in Production</a></li>
<li class="index-links"><time datetime="2024-02-27T17:04:59&#43;03:00">2024 Feb 27</time> &ndash; <a href="/articles/blog/2024-goals/">2024 Goals and Aspirations</a></li> <li class="index-links"><time datetime="2024-02-27T17:04:59&#43;03:00">2024 Feb 27</time> &ndash; <a href="/articles/blog/2024-goals/">2024 Goals and Aspirations</a></li>

View file

@ -9,6 +9,95 @@
<atom:link href="https://vodoraslo.xyz/articles/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/articles/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -33,6 +33,17 @@
<p><strong>Recent posts:</strong></p> <p><strong>Recent posts:</strong></p>
</div> </div>
<ul class="tenRecentPosts"> <ul class="tenRecentPosts">
<li><time
datetime="2024-09-05T17:05:07&#43;03:00">2024 Sep 05</time> &ndash;
<a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/" aria-label="Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache Here&rsquo;s how to only allow authenticated users to view your websites - … ... Click to Read more about Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache"><b class="white_span">Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</b></a> - <span
class="muted_text">Here&rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&rsquo;s (or your …</span> <a href="/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/" aria-label="Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache Here&rsquo;s how to only allow authenticated users to view your websites - … ... Click to Read more about Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</a> <em> (1 minute read).</em> </li>
<li><time
datetime="2024-09-05T16:58:04&#43;03:00">2024 Sep 05</time> &ndash;
<a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in Nginx My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in Nginx"><b class="white_span">Block and Filter Spam Requests With User-Agents in Nginx</b></a> - <span
class="muted_text">My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.
Adapt the …</span> <a href="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/" aria-label="Block and Filter Spam Requests With User-Agents in Nginx My server has been getting bussyblasted by spam requests from bots and … ... Click to Read more about Block and Filter Spam Requests With User-Agents in Nginx" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about Block and Filter Spam Requests With User-Agents in Nginx</a> <em> (1 minute read).</em> </li>
<li><time <li><time
datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash; datetime="2024-08-31T16:12:49&#43;03:00">2024 Aug 31</time> &ndash;
<a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/" aria-label="Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag Hugo currently (v133) provides no way for me to choose where to place my … ... Click to Read more about Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag"><b class="white_span">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</b></a> - <span <a href="/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/" aria-label="Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag Hugo currently (v133) provides no way for me to choose where to place my … ... Click to Read more about Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag"><b class="white_span">Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</b></a> - <span
@ -75,17 +86,6 @@ summarized: …</span> <a href="/articles/blog/2024-goals/" aria-label="2024 Go
<a href="/library/ted-kaczynski/the-littering-ape/" aria-label="The Littering Ape A number of anthropologically inclined individuals have in recent years … ... Click to Read more about The Littering Ape"><b class="white_span">The Littering Ape</b></a> - <span <a href="/library/ted-kaczynski/the-littering-ape/" aria-label="The Littering Ape A number of anthropologically inclined individuals have in recent years … ... Click to Read more about The Littering Ape"><b class="white_span">The Littering Ape</b></a> - <span
class="muted_text">A number of anthropologically inclined individuals have in recent years gained fame and fortune by authoring books of the &ldquo;Naked Ape&rdquo;</span> <a href="/library/ted-kaczynski/the-littering-ape/" aria-label="The Littering Ape A number of anthropologically inclined individuals have in recent years … ... Click to Read more about The Littering Ape" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read class="muted_text">A number of anthropologically inclined individuals have in recent years gained fame and fortune by authoring books of the &ldquo;Naked Ape&rdquo;</span> <a href="/library/ted-kaczynski/the-littering-ape/" aria-label="The Littering Ape A number of anthropologically inclined individuals have in recent years … ... Click to Read more about The Littering Ape" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about The Littering Ape</a> <em> (3 minute read).</em> </li> more about The Littering Ape</a> <em> (3 minute read).</em> </li>
<li><time
datetime="2023-04-15T18:54:10&#43;03:00">2023 Apr 15</time> &ndash;
<a href="/library/ted-kaczynski/morality-and-revolution/" aria-label="Morality and Revolution “Morality, guilt and fear of condemnation act as cops in our heads, … ... Click to Read more about Morality and Revolution"><b class="white_span">Morality and Revolution</b></a> - <span
class="muted_text">“Morality, guilt and fear of condemnation act as cops in our heads, destroying our spontaneity, our wildness, our ability to live our lives to the …</span> <a href="/library/ted-kaczynski/morality-and-revolution/" aria-label="Morality and Revolution “Morality, guilt and fear of condemnation act as cops in our heads, … ... Click to Read more about Morality and Revolution" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about Morality and Revolution</a> <em> (22 minute read).</em> </li>
<li><time
datetime="2023-04-15T18:50:50&#43;03:00">2023 Apr 15</time> &ndash;
<a href="/library/ted-kaczynski/the-systems-neatest-trick/" aria-label="The System&#39;s Neatest Trick The supreme luxury of the society of technical necessity will be to grant … ... Click to Read more about The System&#39;s Neatest Trick"><b class="white_span">The System&#39;s Neatest Trick</b></a> - <span
class="muted_text">The supreme luxury of the society of technical necessity will be to grant the bonus of useless revolt and of an acquiescent smile. —Jacques Ellul1
The …</span> <a href="/library/ted-kaczynski/the-systems-neatest-trick/" aria-label="The System&#39;s Neatest Trick The supreme luxury of the society of technical necessity will be to grant … ... Click to Read more about The System&#39;s Neatest Trick" class="read_more_recent_posts" style="box-shadow: 0 1px 0;">Read
more about The System&#39;s Neatest Trick</a> <em> (25 minute read).</em> </li>
</ul> </ul>
</div> </div>

View file

@ -9,6 +9,95 @@
<atom:link href="https://vodoraslo.xyz/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/library/hackbook/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/library/hackbook/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -9,6 +9,95 @@
<atom:link href="https://vodoraslo.xyz/library/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/library/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/library/ted-kaczynski/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/library/ted-kaczynski/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -2,6 +2,12 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url> <url>
<loc>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</loc>
<lastmod>2024-09-05T17:22:43+03:00</lastmod>
</url><url>
<loc>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</loc>
<lastmod>2024-09-05T17:22:43+03:00</lastmod>
</url><url>
<loc>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</loc> <loc>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</loc>
<lastmod>2024-08-31T17:06:20+03:00</lastmod> <lastmod>2024-08-31T17:06:20+03:00</lastmod>
</url><url> </url><url>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/blog/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/blog/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/hackbook/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/hackbook/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/library/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/library/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/personal/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/personal/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/ted-kaczynski/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/ted-kaczynski/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>

View file

@ -10,6 +10,95 @@
<atom:link href="https://vodoraslo.xyz/tags/updates/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://vodoraslo.xyz/tags/updates/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Restrict Unwanted Access With HTTP Basic Authentication - NGINX and Apache</title>
<link>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</link>
<pubDate>Thu, 05 Sep 2024 17:05:07 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache/</guid>
<description>&lt;p&gt;Here&amp;rsquo;s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system&amp;rsquo;s (&lt;em&gt;or your vps&amp;rsquo;&lt;/em&gt;) resources for yourself.&lt;/p&gt;
&lt;p&gt;The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith&amp;rsquo;s tutorial and have NGINX running with certbot for certificates.&lt;/p&gt;
&lt;h2 id=&#34;create-a-username-and-password-for-authentication-or-more-than-1-user&#34;&gt;Create a username and password for authentication (&lt;em&gt;or more than 1 user&lt;/em&gt;)&lt;/h2&gt;
&lt;p&gt;First:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt install apache2-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a username you wish to authenticate with the following comnmand:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd -c /etc/apache2/.htpasswd admin1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will be prompted to provide a password, feel free to generate a secure 32+ character one and save it in your password manager of choice.&lt;/p&gt;
&lt;p&gt;If you wish to create multiple other users simply remove &lt;code&gt;-c&lt;/code&gt; from the command and change the name.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo htpasswd /etc/apache2/.htpasswd admin2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then provide a new password (the same password can also work but it&amp;rsquo;s more secure that way).&lt;/p&gt;
&lt;h2 id=&#34;add-the-htpasswd-file-to-nginx&#34;&gt;Add the &lt;code&gt;htpasswd&lt;/code&gt; file to NGINX&lt;/h2&gt;
&lt;p&gt;Navigate to the NGINX configuration file you wish to protect:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/nginx/sites-available/&amp;lt;yourFileHere&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Add the following in the same &lt;code&gt;server&lt;/code&gt; block and on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Administrators&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;Area&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;auth_basic_user_file&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;/etc/apache2/.htpasswd&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Further readering &lt;a href=&#34;https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item>
<title>Block and Filter Spam Requests With User-Agents in Nginx</title>
<link>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</link>
<pubDate>Thu, 05 Sep 2024 16:58:04 +0300</pubDate>
<guid>https://vodoraslo.xyz/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/</guid>
<description>&lt;p&gt;My server has been getting bussyblasted by spam requests from bots and other subhumans and I figured out a way to block them with NGINX.&lt;/p&gt;
&lt;p&gt;Adapt the following for your use case and simply place it in every nginx.conf that is &lt;code&gt;ln -s&lt;/code&gt; linked to your &lt;code&gt;/etc/nginx/sites-enabled&lt;/code&gt; (&lt;em&gt;it should be under the &lt;code&gt;listen 443&lt;/code&gt; server block if you use certbot. Don&amp;rsquo;t add it under &lt;code&gt;location&lt;/code&gt; it should be on the same level as &lt;code&gt;listen [::]:443 ssl;&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#c678dd&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#dcaeea&#34;&gt;$http_user_agent&lt;/span&gt; ~&lt;span style=&#34;color:#56b6c2&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#98c379&#34;&gt;&amp;#34;Amazonbot|facebookexternalhit|meta-externalagent|ClaudeBot&amp;#34;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#c678dd&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#d19a66&#34;&gt;404&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To see what kind of requests are being made you can check out the following NGINX file &lt;code&gt;/var/log/nginx/access.log&lt;/code&gt;. Scroll all the way down (if you use vim &lt;code&gt;G&lt;/code&gt;, for nano - &lt;code&gt;Ctrl + End&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I adapted this guide from this fella over here who blocked all Apple devices on his VPS, &lt;a href=&#34;https://web.archive.org/web/20240508084213/https://swindlesmccoop.xyz/blog/blockapple.html&#34;&gt;read more&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;a-better-alternative---basic-http-authentication&#34;&gt;A better alternative - Basic HTTP Authentication&lt;/h2&gt;
&lt;p&gt;A better way of blocking unwated access to your website is to use apache2 + NGINX&amp;rsquo;s basic HTTP authentication, &lt;a href=&#34;https://vodoraslo.xyz/articles/blog/restrict-unwanted-access-with-http-basic-auth-nginx-and-apache&#34;&gt;read my guide&lt;/a&gt;.&lt;/p&gt;
</description>
</item>
<item> <item>
<title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title> <title>Neater Footnotes in Hugo Using the &lt;details&gt; HTML Tag</title>
<link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link> <link>https://vodoraslo.xyz/articles/blog/neater-footnotes-in-hugo-using-the-details-html-tag/</link>